util.h (820B)
1 /* util.h: minimal utility wrappers for origo. */ 2 3 #include <stddef.h> 4 #include <stdio.h> 5 #include <sys/types.h> 6 7 size_t strlcpy(char *, const char *, size_t); 8 size_t strlcat(char *, const char *, size_t); 9 10 void eprintf(const char *, ...); 11 void weprintf(const char *, ...); 12 13 void *emalloc(size_t); 14 void *ecalloc(size_t, size_t); 15 void *erealloc(void *, size_t); 16 void *ereallocarray(void *, size_t, size_t); 17 char *estrdup(const char *); 18 char *estrndup(const char *, size_t); 19 20 long long estrtonum(const char *, long long, long long); 21 22 ssize_t writeall(int, const void *, size_t); 23 int fshut(FILE *, const char *); 24 25 #define LEN(a) (sizeof(a) / sizeof((a)[0])) 26 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 27 #define MAX(x, y) ((x) > (y) ? (x) : (y)) 28 #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4)) 29 30 extern char *argv0;