2 * Sherlock Library -- Miscellaneous Functions
4 * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
7 #include <lib/config.h>
19 void open_temp(struct tempfile *, byte *);
20 void delete_temp(struct tempfile *);
23 #define TF_GENERIC "t"
24 #define TF_QUEUE_CONTROL "c"
25 #define TF_QUEUE_DATA "d"
27 #define TF_TRANSFORM "s"
43 typedef byte *(*ci_func)(struct cfitem *, byte *);
45 void cf_read(byte *, struct cfitem *);
55 void log(byte *, ...);
56 void die(byte *, ...) NONRET;
62 byte *stralloc(byte *);
64 /* Content-Type pattern matching and filters */
68 int match_ct_patt(byte *, byte *);
70 struct ct_filter *new_ct_filter(void);
71 byte *add_ct_filter(struct ct_filter *, byte *);
72 int match_ct_filter(struct ct_filter *, byte *);
77 #define log2(x) (ffs(x) - 1)
84 struct odes { /* Object description */
88 struct oattr { /* Object attribute */
89 struct oattr *next, *same;
94 void obj_dump(struct odes *);
95 struct odes *obj_fload(FILE *);
96 struct odes *obj_new(void);
97 struct odes *obj_load(byte *);
98 void obj_fwrite(FILE *, struct odes *); /* Closes the file afterwards... */
99 void obj_free(struct odes *);
100 struct oattr *find_attr(struct odes *, uns);
101 struct oattr *find_attr_last(struct odes *, uns);
102 byte *find_aval(struct odes *, uns);
103 struct oattr *set_attr(struct odes *, uns, byte *);
104 struct oattr *set_attr_num(struct odes *, uns, uns);
105 struct oattr *add_attr(struct odes *, struct oattr *, uns, byte *);
106 struct oattr *prepend_attr(struct odes *, uns, byte *);
110 void mk_obj_name(byte *, ulg, byte *);
111 FILE *create_obj_file(byte *, ulg);
115 int wordsplit(byte *, byte **, uns);
119 int match_pattern(byte *, byte *);
120 int match_pattern_nocase(byte *, byte *);
124 void md5_to_hex(byte *, byte *);
125 void hex_to_md5(byte *, byte *);
128 #define MD5_HEX_SIZE 33