Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / usr.sbin / cron / externs.h
blobd5f9c276cb5b6038c12499c0ad127f0b43b88ed9
1 /* $NetBSD: externs.h,v 1.3 1998/07/26 13:27:34 mycroft Exp $ */
3 /* Copyright 1993,1994 by Paul Vixie
4 * All rights reserved
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
13 * user.
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)
21 # include <stdlib.h>
22 # include <unistd.h>
23 # include <string.h>
24 # include <dirent.h>
25 # define DIR_T struct dirent
26 # define WAIT_T int
27 # define WAIT_IS_INT 1
28 # define TZONE(tm) tzname[(tm).tm_isdst]
29 #endif
31 #if defined(UNIXPC)
32 # undef WAIT_T
33 # undef WAIT_IS_INT
34 # define WAIT_T union wait
35 #endif
37 #if defined(POSIX)
38 # define SIG_T sig_t
39 # define TIME_T time_t
40 # define PID_T pid_t
41 #endif
43 #if defined(ATT)
44 # define SIG_T void
45 # define TIME_T long
46 # define PID_T int
47 #endif
49 #if !defined(POSIX) && !defined(ATT)
50 /* classic BSD */
51 extern time_t time();
52 extern unsigned sleep();
53 extern struct tm *localtime();
54 extern struct passwd *getpwnam();
55 extern int errno;
56 extern void perror(), exit(), free();
57 extern char *getenv(), *strcpy(), *strchr(), *strtok();
58 extern void *malloc(), *realloc();
59 # define SIG_T void
60 # define TIME_T long
61 # define PID_T int
62 # define WAIT_T union wait
63 # define DIR_T struct direct
64 # include <sys/dir.h>
65 # define TZONE(tm) (tm).tm_zone
66 #endif
68 /* getopt() isn't part of POSIX. some systems define it in <stdlib.h> anyway.
69 * of those that do, some complain that our definition is different and some
70 * do not. to add to the misery and confusion, some systems define getopt()
71 * in ways that we cannot predict or comprehend, yet do not define the adjunct
72 * external variables needed for the interface.
74 #if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS)
75 int getopt(int, char * const *, const char *);
76 #endif
78 #if (!defined(BSD) || (BSD < 199103))
79 extern char *optarg;
80 extern int optind, opterr, optopt;
81 #endif
83 #if WAIT_IS_INT
84 # ifndef WEXITSTATUS
85 # define WEXITSTATUS(x) (((x) >> 8) & 0xff)
86 # endif
87 # ifndef WTERMSIG
88 # define WTERMSIG(x) ((x) & 0x7f)
89 # endif
90 # ifndef WCOREDUMP
91 # define WCOREDUMP(x) ((x) & 0x80)
92 # endif
93 #else /*WAIT_IS_INT*/
94 # ifndef WEXITSTATUS
95 # define WEXITSTATUS(x) ((x).w_retcode)
96 # endif
97 # ifndef WTERMSIG
98 # define WTERMSIG(x) ((x).w_termsig)
99 # endif
100 # ifndef WCOREDUMP
101 # define WCOREDUMP(x) ((x).w_coredump)
102 # endif
103 #endif /*WAIT_IS_INT*/
105 #ifndef WIFSIGNALED
106 #define WIFSIGNALED(x) (WTERMSIG(x) != 0)
107 #endif
108 #ifndef WIFEXITED
109 #define WIFEXITED(x) (WTERMSIG(x) == 0)
110 #endif
112 #ifdef NEED_STRCASECMP
113 extern int strcasecmp(char *, char *);
114 #endif
116 #ifdef NEED_STRDUP
117 extern char *strdup(char *);
118 #endif
120 #ifdef NEED_STRERROR
121 extern char *strerror(int);
122 #endif
124 #ifdef NEED_FLOCK
125 extern int flock(int, int);
126 # define LOCK_SH 1
127 # define LOCK_EX 2
128 # define LOCK_NB 4
129 # define LOCK_UN 8
130 #endif
132 #ifdef NEED_SETSID
133 extern int setsid(void);
134 #endif
136 #ifdef NEED_GETDTABLESIZE
137 extern int getdtablesize(void);
138 #endif
140 #ifdef NEED_SETENV
141 extern int setenv(char *, char *, int);
142 #endif
144 #ifdef NEED_VFORK
145 extern PID_T vfork(void);
146 #endif