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;
58 void open_log_file(byte *);
63 byte *stralloc(byte *);
65 /* Content-Type pattern matching and filters */
69 int match_ct_patt(byte *, byte *);
71 struct ct_filter *new_ct_filter(void);
72 byte *add_ct_filter(struct ct_filter *, byte *);
73 int match_ct_filter(struct ct_filter *, byte *);
78 #define log2(x) (ffs(x) - 1)
85 struct odes { /* Object description */
90 struct oattr { /* Object attribute */
91 struct oattr *next, *same;
96 void obj_dump(struct odes *);
97 struct odes *obj_fload(FILE *);
98 struct odes *obj_new(void);
99 struct odes *obj_load(byte *);
100 void obj_fwrite(FILE *, struct odes *);
101 void obj_write(byte *, struct odes *);
102 void obj_free(struct odes *);
103 struct oattr *find_attr(struct odes *, uns);
104 struct oattr *find_attr_last(struct odes *, uns);
105 uns del_attr(struct odes *, struct oattr *);
106 byte *find_aval(struct odes *, uns);
107 struct oattr *set_attr(struct odes *, uns, byte *);
108 struct oattr *set_attr_num(struct odes *, uns, uns);
109 struct oattr *add_attr(struct odes *, struct oattr *, uns, byte *);
110 struct oattr *prepend_attr(struct odes *, uns, byte *);
114 void mk_obj_name(byte *, ulg, byte *);
115 int dump_obj_to_file(byte *, ulg, struct odes *, int);
119 int wordsplit(byte *, byte **, uns);
123 int match_pattern(byte *, byte *);
124 int match_pattern_nocase(byte *, byte *);
128 void md5_to_hex(byte *, byte *);
129 void hex_to_md5(byte *, byte *);
132 #define MD5_HEX_SIZE 33
141 void init_timer(void);
146 typedef struct regex regex;
148 regex *rx_compile(byte *r);
149 void rx_free(regex *r);
150 int rx_match(regex *r, byte *s);
151 int rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen);