mg

port of mg editor (openbsd to linux)
Log | Files | Refs | README

commit e78e8fa4fe7355a0df632eb69ecf6ef7152b0f29
parent 5287128a64de5de6c7ceb21227c8c878aa058121
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 24 Nov 2014 20:53:37 +0100

include and add util.h

Diffstat:
def.h | 1+
libopenbsd/util.h | 10++++++++++
libutil/util.h | 51+--------------------------------------------------
3 files changed, 12 insertions(+), 50 deletions(-)

diff --git a/def.h b/def.h @@ -13,6 +13,7 @@ #include "sysdef.h" /* Order is critical. */ #include "ttydef.h" #include "chrdef.h" +#include "libopenbsd/util.h" typedef int (*PF)(int, int); /* generally useful type */ diff --git a/libopenbsd/util.h b/libopenbsd/util.h @@ -0,0 +1,10 @@ +/* some libc's like musl don't support REG_STARTEND (yet) and + * glibc has some differences compared to OpenBSD */ +#ifndef REG_STARTEND +#define REG_STARTEND 0 +#endif + +void * reallocarray(void *, size_t, size_t); +size_t strlcat(char *, const char *, size_t); +size_t strlcpy(char *, const char *, size_t); +long long strtonum(const char *, long long, long long, const char **); diff --git a/libutil/util.h b/libutil/util.h @@ -69,55 +69,6 @@ */ #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */ -/* - * stub struct definitions. - */ -struct __sFILE; -struct login_cap; -struct passwd; -struct termios; -struct utmp; -struct winsize; - -__BEGIN_DECLS -char *fparseln(struct __sFILE *, size_t *, size_t *, const char[3], int); -void login(struct utmp *); -int login_tty(int); -int logout(const char *); -void logwtmp(const char *, const char *, const char *); -int opendev(const char *, int, int, char **); -int pidfile(const char *); -void pw_setdir(const char *); -char *pw_file(const char *); -int pw_lock(int); -int pw_mkdb(char *, int); -int pw_abort(void); -void pw_init(void); -void pw_edit(int, const char *); -void pw_prompt(void); -void pw_copy(int, int, const struct passwd *, const struct passwd *); -int pw_scan(char *, struct passwd *, int *); -void pw_error(const char *, int, int); -int openpty(int *, int *, char *, struct termios *, struct winsize *); -int opendisk(const char *, int, char *, size_t, int); -pid_t forkpty(int *, char *, struct termios *, struct winsize *); -int getmaxpartitions(void); -int getrawpartition(void); -void login_fbtab(const char *, uid_t, gid_t); -int login_check_expire(struct __sFILE *, struct passwd *, char *, int); -char *readlabelfs(char *, int); -const char *uu_lockerr(int); -int uu_lock(const char *); -int uu_lock_txfr(const char *, pid_t); -int uu_unlock(const char *); -int fmt_scaled(long long, char *); -int scan_scaled(char *, long long *); -int isduid(const char *, int); -int pkcs5_pbkdf2(const char *, size_t, const uint8_t *, size_t, - uint8_t *, size_t, unsigned int); -int bcrypt_pbkdf(const char *, size_t, const uint8_t *, size_t, - uint8_t *, size_t, unsigned int); - -__END_DECLS +char *fparseln(FILE *, size_t *, size_t *, const char[3], int); #endif /* !_UTIL_H_ */