ind.h (1229B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 */ 5 6 #ifndef IND_H 7 #define IND_H 8 9 #include <stdio.h> 10 11 extern int glfd; 12 13 typedef struct Elems Elems; 14 struct Elems { 15 char **e; 16 int num; 17 }; 18 19 typedef struct Indexs Indexs; 20 struct Indexs { 21 Elems **n; 22 int num; 23 }; 24 25 typedef struct filetype filetype; 26 struct filetype { 27 char *end; 28 char *type; 29 void (* f)(int, char *, char *, char *, char *, char *, char *, 30 char *, char *, int); 31 }; 32 33 filetype *gettype(char *filename); 34 void *xcalloc(size_t, size_t); 35 void *xmalloc(size_t); 36 void *xrealloc(void *, size_t); 37 char *xstrdup(const char *str); 38 int xsendfile(int, int); 39 Indexs *scanfile(char *fname); 40 Elems *getadv(char *str); 41 int pendingbytes(int sock); 42 void waitforpendingbytes(int sock); 43 int printelem(int fd, Elems *el, char *file, char *base, char *addr, char *port); 44 void addindexs(Indexs *idx, Elems *el); 45 void addelem(Elems *e, char *s); 46 void freeindex(Indexs *i); 47 void freeelem(Elems *e); 48 char *smprintf(char *fmt, ...); 49 char *reverselookup(char *host); 50 void setcgienviron(char *file, char *path, char *port, char *base, 51 char *args, char *sear, char *ohost, char *chost, 52 char *bhost, int istls); 53 char *humansize(off_t n); 54 char *humantime(const time_t *clock); 55 56 #endif 57