-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.h
72 lines (62 loc) · 1.36 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef COMMON_H
#define COMMON_H
// Show debug() output by default
#define DEBUG_OUTPUT
// Config file name
#define CFG_FILE "gsconf.cfg"
// mmap() support
#define HAVE_MMAP
// Needed to prevent struct stat problems
#define _FILE_OFFSET_BITS 64
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <assert.h>
#include <dirent.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <netdb.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/param.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#ifndef NULL
#define NULL 0
#endif
#ifdef __GNUC__
#define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
#else
#define PRINTF_LIKE(M,N)
#endif
#if __GNUC__ >= 2
# define UNUSED_ARG(ARG) ARG __attribute__((unused))
# if __GNUC__ >= 4
# define NULL_SENTINEL __attribute__((sentinel))
# else
# define NULL_SENTINEL
# endif
#else
# define UNUSED_ARG(ARG) ARG
#endif
#define ArraySize(ARRAY) (sizeof((ARRAY)) / sizeof((ARRAY)[0]))
#define xfree(PTR) do { if(PTR) free(PTR); } while(0)
#include "tools.h"
#include "dict.h"
#endif