X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Flib.h;h=70b2e3661788be4d62360aa94fa480a68c14ca9a;hb=af73897286e5feff4d60f182c26b719d544b142d;hp=e72646719feeede663ee07d5ffc7e6f19b28669b;hpb=b3f090b9c4e6a70edb59c562aff3580b7d7ef05e;p=libucw.git diff --git a/lib/lib.h b/lib/lib.h index e7264671..70b2e366 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -4,6 +4,9 @@ * (c) 1997 Martin Mares, */ +#ifndef _SHERLOCK_LIB_H +#define _SHERLOCK_LIB_H + #include /* Temporary Files */ @@ -43,6 +46,7 @@ struct cfitem { typedef byte *(*ci_func)(struct cfitem *, byte *); void cf_read(byte *, struct cfitem *); +int cf_read_err(byte *, struct cfitem *); /* Read with possible error, 1 = succeeded */ /* Logging */ @@ -60,6 +64,7 @@ void open_log_file(byte *); /* Allocation */ void *xmalloc(uns); +void *xrealloc(void *, uns); byte *stralloc(byte *); /* Content-Type pattern matching and filters */ @@ -74,11 +79,7 @@ int match_ct_filter(struct ct_filter *, byte *); /* Binary log */ -#ifdef HAVE_FFS -#define log2(x) (ffs(x) - 1) -#else int log2(ulg); -#endif /* obj.c */ @@ -94,7 +95,7 @@ struct oattr { /* Object attribute */ }; void obj_dump(struct odes *); -struct odes *obj_fload(FILE *); +struct odes *obj_fload(FILE *, byte *); struct odes *obj_new(void); struct odes *obj_load(byte *); void obj_fwrite(FILE *, struct odes *); @@ -111,8 +112,11 @@ struct oattr *prepend_attr(struct odes *, uns, byte *); /* oname.c */ +#define OID_MIN 0x10000 /* Values less than this have special meaning */ + +ulg new_oid(uns); void mk_obj_name(byte *, ulg, byte *); -FILE *create_obj_file(byte *, ulg); +int dump_obj_to_file(byte *, ulg, struct odes *, int); /* wordsplit.c */ @@ -140,3 +144,14 @@ uns nextprime(uns); void init_timer(void); uns get_timer(void); + +/* regex.c */ + +typedef struct regex regex; + +regex *rx_compile(byte *r); +void rx_free(regex *r); +int rx_match(regex *r, byte *s); +int rx_subst(regex *r, byte *by, byte *src, byte *dest, uns destlen); + +#endif