util.h - quark - quark web server
 (HTM) git clone git://git.suckless.org/quark
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       util.h (952B)
       ---
            1 /* See LICENSE file for copyright and license details. */
            2 #ifndef UTIL_H
            3 #define UTIL_H
            4 
            5 #include <regex.h>
            6 #include <stddef.h>
            7 #include <time.h>
            8 
            9 #include "config.h"
           10 
           11 /* general purpose buffer */
           12 struct buffer {
           13         char data[BUFFER_SIZE];
           14         size_t len;
           15 };
           16 
           17 #undef MIN
           18 #define MIN(x,y)  ((x) < (y) ? (x) : (y))
           19 #undef MAX
           20 #define MAX(x,y)  ((x) > (y) ? (x) : (y))
           21 #undef LEN
           22 #define LEN(x) (sizeof (x) / sizeof *(x))
           23 
           24 extern char *argv0;
           25 
           26 void warn(const char *, ...);
           27 void die(const char *, ...);
           28 
           29 void epledge(const char *, const char *);
           30 void eunveil(const char *, const char *);
           31 
           32 int timestamp(char *, size_t, time_t);
           33 int esnprintf(char *, size_t, const char *, ...);
           34 int prepend(char *, size_t, const char *);
           35 int spacetok(const char *, char **, size_t);
           36 
           37 void *reallocarray(void *, size_t, size_t);
           38 long long strtonum(const char *, long long, long long, const char **);
           39 
           40 int buffer_appendf(struct buffer *, const char *, ...);
           41 
           42 #endif /* UTIL_H */