X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Flib.h;h=dea7c10c8929fa7fe923d24f69bbb78d12204e0a;hb=0eea3757c0ee4462a641562ba03c893548971d8f;hp=eb079dcd6fe94139b24643c856a1dc7e21256d8e;hpb=948bf112e3b3aba44e2dabfd0fa47724097166d3;p=libucw.git diff --git a/lib/lib.h b/lib/lib.h index eb079dcd..dea7c10c 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -30,22 +30,9 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define CLAMP(x,min,max) ({ int _t=x; (_t < min) ? min : (_t > max) ? max : _t; }) +#define ABS(x) ((x) < 0 ? -(x) : (x)) #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a))) -/* Temporary Files */ - -#define TMP_DIR "tmp" -#define TMP_DIR_LEN 3 - -struct tempfile { - int fh; - byte name[32]; -}; - -void open_temp(struct tempfile *, byte *); -void delete_temp(struct tempfile *); -u32 temprand(uns); - /* Logging */ #define L_DEBUG 'D' /* Debugging messages */ @@ -170,7 +157,7 @@ uns get_timer(void); typedef struct regex regex; -regex *rx_compile(byte *r); +regex *rx_compile(byte *r, int icase); 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); @@ -184,4 +171,13 @@ uns random_max(uns); void *mmap_file(byte *name, unsigned *len, int writeable); void munmap_file(void *start, unsigned len); +/* proctitle.c */ + +void setproctitle_init(int argc, char **argv); +void setproctitle(char *msg, ...) __attribute__((format(printf,1,2))); + +/* randomkey.c */ + +void randomkey(byte *buf, uns size); + #endif