1 /*
2   util.h
3 
4   $Id: util.h,v 1.5 2005/05/30 02:13:28 evertonm Exp $
5  */
6 
7 #ifndef UTIL_H
8 #define UTIL_H
9 
10 #include <sys/time.h>
11 #include <sys/types.h>
12 #include <unistd.h>
13 
14 #include "config.h"
15 
16 extern int verbose_mode;
17 
18 #define ONVERBOSE(proc) if (verbose_mode) (proc);
19 #define ONVERBOSE2(proc) if (verbose_mode > 1) (proc);
20 #define ONVERBOSE3(proc) if (verbose_mode > 2) (proc);
21 #define DEBUGFD(proc) ONVERBOSE3(proc)
22 
23 void set_prog_name(const char *name);
24 const char *get_prog_name();
25 
26 char* safe_strdup(const char* str);
27 void safe_strcpy(char *trg, const char *src, int trg_buf_size);
28 
29 int cd_root();
30 int std_to_null();
31 int daemonize();
32 
33 void socket_close(int fd);
34 
35 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
36 
37 #endif /* UTIL_H */
38 
39 /* eof: util.h */
40