utils.h (809B)
1 #ifndef UTILS_H 2 #define UTILS_H 3 4 #include <stdio.h> 5 #include <dirent.h> 6 #include <sys/stat.h> 7 8 extern const int BLEN; 9 10 extern void quit(int code, char *fmt, ...); 11 extern void die(int code, char *fmt, ...); 12 13 extern void rtrim(char *s); 14 15 typedef void (*in_cb)(void *udata, FILE* in); 16 typedef void (*out_cb)(void *udata, FILE* out); 17 typedef void (*tmpf_cb)(void *udata, char *fname); 18 typedef int (*dir_cb)(void *udata, char *path, char *fname, struct dirent *e, struct stat *s); 19 20 extern void in(void *udata, in_cb cb, char *cmd, ...); 21 extern void out(void *udata, out_cb cb, char *cmd, ...); 22 extern void tmpf(void *udata, tmpf_cb cb, char *fname, ...); 23 extern void dir(void *udata, dir_cb cb, char *path, ...); 24 25 extern int systemf(char *cmd, ...); 26 extern void wget(char *url, char *fname); 27 28 #endif /* UTILS_H */