forked from 7jXlqS-hmpBUGsK/iscabbs-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.h
161 lines (138 loc) · 3.14 KB
/
defs.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
* defs.h - All needed include files.
*/
// Feature test macros must come first, before any includes.
// see `feature_test_macros(7)`.
#if !defined(_POSIX_C_SOURCE)
#define _POSIX_C_SOURCE 200809L // enables strdup, popen, etc.
#endif
#if !defined(_DEFAULT_SOURCE)
#define _DEFAULT_SOURCE // enables nice, caddr_t.
#endif
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#ifdef _WHIP
#include "whip.h"
#else
#include <stdio.h>
#include <ctype.h>
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <strings.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <setjmp.h>
#include <syslog.h>
#include <sys/mman.h>
#include <sys/sem.h>
#include <sys/resource.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#ifdef __hpux
#include <sys/pstat.h>
#include <sys/rtprio.h>
#endif
#ifdef _SSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#endif
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
#define NO 0
#define YES 1
#define OFF 0
#define ON 1
#define STDINBUFSIZ 256
#define STDOUTBUFSIZ 960
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
/* define this to allow the bbs to logout users after n minutes */
#define IDLELOGOUT 1440
/* define this if you want users logged out after 6000 minutes. I should
make this smarter */
#define TOTALTIMELIMIT
#include "bbs.h"
#include "proto.h"
#ifdef INQUEUE
#include "qtelnet.h"
#else
#include "telnet.h"
#endif
#include "users.h"
#include "queue.h"
extern char **environ;
#define BBS 1
#define FINGER 2
#define QUEUE 3
#define INIT 4
#define SYNC 5
#define UPDATE 6
#define BACKUP 7
#ifdef _WHIP
#undef SOMAXCONN
#define SOMAXCONN 128
#endif
#if 1
#define FLUSH(a,b) ((b = q->qt[a].nfrontp - q->qt[a].nbackp) ? (!ssend(a, (const char*) q->qt[a].nbackp, b) ? ((q->qt[a].nbackp = q->qt[a].nfrontp = q->qt[a].netobuf), 0) : -1) : 0)
#else
#define FLUSH(a,b) if (b = q->qt[a].nfrontp - q->qt[a].nbackp)\
{\
if (!ssend(a, q->qt[a].nbackp, b))\
q->qt[a].nbackp = q->qt[a].nfrontp = q->qt[a].netobuf;\
}
#endif
/*
* Sure would be nice if there was a standard interface to this kind of
* information, it is very useful.
*/
#ifdef __linux__
#ifdef _IO_file_flags
#define INPUT_LEFT() ((stdin)->_IO_read_ptr < (stdin)->_IO_read_end)
#else
//#define INPUT_LEFT() ((stdin)->_gptr < (stdin)->_egptr)
#define INPUT_LEFT() ((stdin)->_IO_read_ptr < (stdin)->_IO_read_end)
#endif
#else
#if (BSD >= 44) || defined(bsdi)
#define INPUT_LEFT() ((stdin)->_r > 0)
#else
#define INPUT_LEFT() ((stdin)->_cnt > 0)
#endif
#endif
/* FreeBSD 4.4 spelling errors */
#ifndef MAP_ANONYMOUS
# define MAP_ANONYMOUS MAP_ANON
#endif
#ifndef O_SYNC
# define O_SYNC O_FSYNC
#endif
#ifndef SIGCLD
# define SIGCLD SIGCHLD
#endif