From cb8af6e7bf5f6e70fc9722d36448213c719e83c8 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Thu, 19 May 2016 16:47:06 -0400 Subject: implement more of dunnet --- src/util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 8007ec8..a6965be 100644 --- a/src/util.h +++ b/src/util.h @@ -23,6 +23,11 @@ #define WSPACE " \t\r\n" +/* convenience macros */ +#define ARRAYLEN(x) (sizeof(x)/sizeof(x[0])) +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + /* utility functions */ void __attribute__((noreturn,format(printf,1,2))) error(const char *fmt, ...); void __attribute__((format(printf,4,5))) debugf_real(const char*, int, const char*, const char *fmt, ...); @@ -48,6 +53,9 @@ uint64_t read_uint64(int fd); void write_size(int fd, size_t); size_t read_size(int fd); +void write_int(int fd, int i); +int read_int(int fd); + bool is_vowel(char c); size_t strlcat(char *dst, const char *src, size_t siz); -- cgit v1.1