1 /*
2  * $Id: includes.h,v 1.3 2005/11/07 22:41:42 sobomax Exp $
3  *
4  * Copyright (C) 1997 Lars Fenneberg
5  *
6  * Copyright 1992 Livingston Enterprises, Inc.
7  *
8  * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
9  * and Merit Network, Inc. All Rights Reserved
10  *
11  * See the file COPYRIGHT for the respective terms and conditions.
12  * If the file is missing contact me at lf@elemental.net
13  * and I'll send you a copy.
14  *
15  */
16 
17 #include "config.h"
18 
19 /* AIX requires this to be the first thing in the file.  */
20 #ifndef __GNUC__
21 # if HAVE_ALLOCA_H
22 #  include <alloca.h>
23 # else
24 #  ifdef _AIX
25 #   pragma alloca
26 #  else
27 #   ifndef alloca /* predefined by HP cc +Olibcalls */
28      char *alloca ();
29 #   endif
30 #  endif
31 # endif
32 #endif
33 
34 #include <sys/types.h>
35 
36 #include <ctype.h>
37 #include <stdio.h>
38 #include <errno.h>
39 #include <netdb.h>
40 #include <syslog.h>
41 
42 #ifdef STDC_HEADERS
43 # include <stdlib.h>
44 # include <string.h>
45 # include <stdarg.h>
46 #else
47 # include <stdarg.h>
48 # ifndef HAVE_STRCHR
49 #  define strchr index
50 #  define strrchr rindex
51 # endif
52 #endif
53 
54 /* I realize that this is ugly and unsafe.. :( */
55 #ifndef HAVE_SNPRINTF
56 # define snprintf(buf, len, format, args...) sprintf(buf, format, ## args)
57 #endif
58 #ifndef HAVE_VSNPRINTF
59 # define vsnprintf(buf, len, format, ap) vsprintf(buf, format, ap)
60 #endif
61 
62 #ifdef HAVE_UNISTD_H
63 # include <unistd.h>
64 #endif /* HAVE_UNISTD_H */
65 
66 #ifdef HAVE_FCNTL_H
67 # include <fcntl.h>
68 #endif
69 
70 #ifdef HAVE_SYS_FCNTL_H
71 # include <sys/fcntl.h>
72 #endif
73 
74 #ifdef HAVE_SYS_FILE_H
75 # include <sys/file.h>
76 #endif
77 
78 #ifdef HAVE_SYS_STAT_H
79 # include <sys/stat.h>
80 #endif
81 
82 #ifdef HAVE_SYS_UTSNAME_H
83 # include <sys/utsname.h>
84 #endif
85 
86 #ifdef HAVE_SYS_IOCTL_H
87 # include <sys/ioctl.h>
88 #endif
89 
90 #ifdef HAVE_CRYPT_H
91 # include <crypt.h>
92 #endif
93 
94 #ifdef HAVE_LIMITS_H
95 # include <limits.h>
96 #endif
97 
98 #ifdef HAVE_TERMIOS_H
99 # include <termios.h>
100 #endif
101 
102 #ifndef PATH_MAX
103 #define PATH_MAX        1024
104 #endif
105 
106 #ifndef UCHAR_MAX
107 # ifdef  __STDC__
108 #  define UCHAR_MAX       255U
109 # else
110 #  define UCHAR_MAX       255
111 # endif
112 #endif
113 
114 #include <pwd.h>
115 #include <sys/socket.h>
116 #include <netinet/in.h>
117 #include <arpa/inet.h>
118 
119 #if defined(HAVE_SIGNAL_H)
120 # include <signal.h>
121 #endif
122 #if defined(HAVE_SYS_SIGNAL_H)
123 # include <sys/signal.h>
124 #endif
125 
126 #ifdef NEED_SIG_PROTOTYPES
127 int sigemptyset(sigset_t *);
128 int sigaddset(sigset_t *, int);
129 int sigprocmask (int, sigset_t *, sigset_t *);
130 #endif
131 
132 #if HAVE_GETOPT_H
133 # include <getopt.h>
134 #endif
135 
136 #if defined(HAVE_SHADOW_H) && defined(HAVE_SHADOW_PASSWORDS)
137 # include <shadow.h>
138 #endif
139 
140 #if TIME_WITH_SYS_TIME
141 # include <sys/time.h>
142 # include <time.h>
143 #else
144 # if HAVE_SYS_TIME_H
145 #  include <sys/time.h>
146 # else
147 #  include <time.h>
148 # endif
149 #endif
150 
151 /*
152  * prefer srandom/random over srand/rand as there generator has a
153  * better distribution of the numbers on certain systems.
154  * on Linux both generators are identical.
155  */
156 #ifndef HAVE_RANDOM
157 # ifdef HAVE_RAND
158 # define srandom        srand
159 # define random         rand
160 # endif
161 #endif
162 
163 /* rlib/lock.c */
164 int do_lock_exclusive(int);
165 int do_unlock(int);
166