f1711d5cbded6537529e55495da1e494d7213b60
[mmh] / h / nmh.h
1
2 /*
3  * nmh.h -- system configuration header file
4  */
5
6 #include <config.h>
7
8 #ifdef HAVE_UNISTD_H
9 # include <sys/types.h>
10 # include <unistd.h>
11 #endif
12
13 #include <stdio.h>
14 #include <ctype.h>
15 #include <sys/stat.h>
16
17 #if HAVE_DIRENT_H
18 # include <dirent.h>
19 # define NLENGTH(dirent) strlen((dirent)->d_name)
20 #else
21 # define dirent direct
22 # define NLENGTH(dirent) (dirent)->d_namlen
23 # if HAVE_SYS_NDIR_H
24 #  include <sys/ndir.h>
25 # endif
26 # if HAVE_SYS_DIR_H
27 #  include <sys/dir.h>
28 # endif
29 # if HAVE_NDIR_H
30 #  include <ndir.h>
31 # endif
32 #endif
33
34 #ifdef HAVE_STDLIB_H
35 # include <stdlib.h>
36 #endif
37
38 #include <stdarg.h>
39
40 #if STDC_HEADERS || HAVE_STRING_H
41 # include <string.h>
42 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
43 # if !STDC_HEADERS && HAVE_MEMORY_H
44 #  include <memory.h>
45 # endif /* not STDC_HEADERS and HAVE_MEMORY_H */
46 #else   /* not STDC_HEADERS and not HAVE_STRING_H */
47 # include <strings.h>
48 /* memory.h and strings.h conflict on some systems.  */
49 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
50
51 #ifdef HAVE_SYS_PARAM_H
52 # include <sys/param.h>
53 #endif
54
55 #ifdef HAVE_LOCALE_H
56 # include <locale.h>
57 #endif
58
59 #ifdef HAVE_LIMITS_H
60 # include <limits.h>
61 #endif
62
63 /*
64  * symbolic constants for lseek and fseek
65  */
66 #ifndef SEEK_SET
67 # define SEEK_SET 0
68 #endif
69 #ifndef SEEK_CUR
70 # define SEEK_CUR 1
71 #endif
72 #ifndef SEEK_END
73 # define SEEK_END 2
74 #endif
75
76 /*
77  * we should be getting this value from pathconf(_PC_PATH_MAX)
78  */
79 #ifndef PATH_MAX
80 # ifdef MAXPATHLEN
81 #  define PATH_MAX MAXPATHLEN
82 # else
83    /* so we will just pick something */
84 #  define PATH_MAX 1024
85 # endif
86 #endif
87
88 /*
89  * we should get this value from sysconf(_SC_NGROUPS_MAX)
90  */
91 #ifndef NGROUPS_MAX
92 # ifdef NGROUPS
93 #  define NGROUPS_MAX NGROUPS
94 # else
95 #  define NGROUPS_MAX 16
96 # endif
97 #endif
98
99 /*
100  * we should be getting this value from sysconf(_SC_OPEN_MAX)
101  */
102 #ifndef OPEN_MAX
103 # ifdef NOFILE
104 #  define OPEN_MAX NOFILE
105 # else
106    /* so we will just pick something */
107 #  define OPEN_MAX 64
108 # endif
109 #endif
110
111 #include <signal.h>
112  
113 #define bcmp(b1,b2,length)      memcmp(b1, b2, length)
114 #define bcopy(b1,b2,length)     memcpy (b2, b1, length)
115 #define bcpy(b1,b2,length)      memcmp (b1, b2, length)
116 #define bzero(b,length)         memset (b, 0, length)
117
118 #ifdef HAVE_KILLPG
119 # define KILLPG(pgrp,sig) killpg(pgrp,sig);
120 #else
121 # define KILLPG(pgrp,sig) kill((-pgrp),sig);
122 #endif
123
124 /*
125  * If your stat macros are broken,
126  * we will just undefine them.
127  */
128 #ifdef STAT_MACROS_BROKEN
129 # ifdef S_ISBLK
130 #  undef S_ISBLK
131 # endif 
132 # ifdef S_ISCHR
133 #  undef S_ISCHR
134 # endif 
135 # ifdef S_ISDIR
136 #  undef S_ISDIR
137 # endif 
138 # ifdef S_ISFIFO
139 #  undef S_ISFIFO
140 # endif 
141 # ifdef S_ISLNK
142 #  undef S_ISLNK
143 # endif 
144 # ifdef S_ISMPB
145 #  undef S_ISMPB
146 # endif 
147 # ifdef S_ISMPC
148 #  undef S_ISMPC
149 # endif 
150 # ifdef S_ISNWK
151 #  undef S_ISNWK
152 # endif 
153 # ifdef S_ISREG
154 #  undef S_ISREG
155 # endif 
156 # ifdef S_ISSOCK
157 #  undef S_ISSOCK
158 # endif 
159 #endif  /* STAT_MACROS_BROKEN.  */
160