3 /* Copyright 1993,1994 by Paul Vixie
6 * Distribute freely, except: don't remove my name from the source or
7 * documentation (don't take credit for my work), mark your changes (don't
8 * get me blamed for your possible bugs), don't alter or remove this
9 * notice. May be sold if buildable source is provided to buyer. No
10 * warrantee of any kind, express or implied, is included with this
11 * software; use at your own risk, responsibility for damages (if any) to
12 * anyone resulting from the use of this software rests entirely with the
15 * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
16 * I'll try to keep a version up to date. I can be reached as follows:
17 * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
20 #if defined(POSIX) || defined(ATT)
25 # define DIR_T struct dirent
27 # define WAIT_IS_INT 1
28 extern char *tzname[2];
29 # define TZONE(tm) tzname[(tm).tm_isdst]
35 # define WAIT_T union wait
40 # define TIME_T time_t
50 #if !defined(POSIX) && !defined(ATT)
53 extern unsigned sleep();
54 extern struct tm *localtime();
55 extern struct passwd *getpwnam();
57 extern void perror(), exit(), free();
58 extern char *getenv(), *strcpy(), *strchr(), *strtok();
59 extern void *malloc(), *realloc();
63 # define WAIT_T union wait
64 # define DIR_T struct direct
66 # define TZONE(tm) (tm).tm_zone
69 /* getopt() isn't part of POSIX. some systems define it in <stdlib.h> anyway.
70 * of those that do, some complain that our definition is different and some
71 * do not. to add to the misery and confusion, some systems define getopt()
72 * in ways that we cannot predict or comprehend, yet do not define the adjunct
73 * external variables needed for the interface.
75 #if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS)
76 int getopt(int, char * const *, const char *);
79 #if (!defined(BSD) || (BSD < 199103))
81 extern int optind, opterr, optopt;
86 # define WEXITSTATUS(x) (((x) >> 8) & 0xff)
89 # define WTERMSIG(x) ((x) & 0x7f)
92 # define WCOREDUMP(x) ((x) & 0x80)
96 # define WEXITSTATUS(x) ((x).w_retcode)
99 # define WTERMSIG(x) ((x).w_termsig)
102 # define WCOREDUMP(x) ((x).w_coredump)
104 #endif /*WAIT_IS_INT*/
107 #define WIFSIGNALED(x) (WTERMSIG(x) != 0)
110 #define WIFEXITED(x) (WTERMSIG(x) == 0)
113 #ifdef NEED_STRCASECMP
114 extern int strcasecmp(char *, char *);
118 extern char *strdup(char *);
122 extern char *strerror(int);
126 extern int flock(int, int);
134 extern int setsid(void);
137 #ifdef NEED_GETDTABLESIZE
138 extern int getdtablesize(void);
142 extern int setenv(char *, char *, int);
146 extern PID_T vfork(void);