3efe605897ec22c725d453b59582f10d71cb191b
[dragonfly.git] / usr.sbin / cron / cron / externs.h
1 /* Copyright 1993,1994 by Paul Vixie
2  * All rights reserved
3  *
4  * Distribute freely, except: don't remove my name from the source or
5  * documentation (don't take credit for my work), mark your changes (don't
6  * get me blamed for your possible bugs), don't alter or remove this
7  * notice.  May be sold if buildable source is provided to buyer.  No
8  * warrantee of any kind, express or implied, is included with this
9  * software; use at your own risk, responsibility for damages (if any) to
10  * anyone resulting from the use of this software rests entirely with the
11  * user.
12  *
13  * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14  * I'll try to keep a version up to date.  I can be reached as follows:
15  * Paul Vixie          <paul@vix.com>          uunet!decwrl!vixie!paul
16  */
17
18 #if defined(POSIX) || defined(ATT)
19 # include <stdlib.h>
20 # include <unistd.h>
21 # include <string.h>
22 # include <dirent.h>
23 # define DIR_T  struct dirent
24 # define WAIT_T int
25 # define WAIT_IS_INT 1
26 extern char *tzname[2];
27 # define TZONE(tm) tzname[(tm).tm_isdst]
28 #endif
29
30 #if defined(UNIXPC)
31 # undef WAIT_T
32 # undef WAIT_IS_INT
33 # define WAIT_T union wait
34 #endif
35
36 #if defined(POSIX)
37 # define SIG_T  sig_t
38 # define TIME_T time_t
39 # define PID_T pid_t
40 #endif
41
42 #if defined(ATT)
43 # define SIG_T  void
44 # define TIME_T long
45 # define PID_T int
46 #endif
47
48 #if !defined(POSIX) && !defined(ATT)
49 /* classic BSD */
50 extern  time_t          time();
51 extern  unsigned        sleep();
52 extern  struct tm       *localtime();
53 extern  struct passwd   *getpwnam();
54 extern  int             errno;
55 extern  void            perror(), exit(), free();
56 extern  char            *getenv(), *strcpy(), *strchr(), *strtok();
57 extern  void            *malloc(), *realloc();
58 # define SIG_T  void
59 # define TIME_T long
60 # define PID_T int
61 # define WAIT_T union wait
62 # define DIR_T  struct direct
63 # include <sys/dir.h>
64 # define TZONE(tm) (tm).tm_zone
65 #endif
66
67 /* getopt() isn't part of POSIX.  some systems define it in <stdlib.h> anyway.
68  * of those that do, some complain that our definition is different and some
69  * do not.  to add to the misery and confusion, some systems define getopt()
70  * in ways that we cannot predict or comprehend, yet do not define the adjunct
71  * external variables needed for the interface.
72  */
73 #if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS)
74 int     getopt __P((int, char * const *, const char *));
75 #endif
76
77 #if (!defined(BSD) || (BSD < 199103))
78 extern  char *optarg;
79 extern  int optind, opterr, optopt;
80 #endif
81
82 #if WAIT_IS_INT
83 # ifndef WEXITSTATUS
84 #  define WEXITSTATUS(x) (((x) >> 8) & 0xff)
85 # endif
86 # ifndef WTERMSIG
87 #  define WTERMSIG(x)   ((x) & 0x7f)
88 # endif
89 # ifndef WCOREDUMP
90 #  define WCOREDUMP(x)  ((x) & 0x80)
91 # endif
92 #else /*WAIT_IS_INT*/
93 # ifndef WEXITSTATUS
94 #  define WEXITSTATUS(x) ((x).w_retcode)
95 # endif
96 # ifndef WTERMSIG
97 #  define WTERMSIG(x)   ((x).w_termsig)
98 # endif
99 # ifndef WCOREDUMP
100 #  define WCOREDUMP(x)  ((x).w_coredump)
101 # endif
102 #endif /*WAIT_IS_INT*/
103
104 #ifndef WIFSIGNALED
105 #define WIFSIGNALED(x)  (WTERMSIG(x) != 0)
106 #endif
107 #ifndef WIFEXITED
108 #define WIFEXITED(x)    (WTERMSIG(x) == 0)
109 #endif
110
111 #ifdef NEED_STRCASECMP
112 extern  int             strcasecmp __P((char *, char *));
113 #endif
114
115 #ifdef NEED_STRDUP
116 extern  char            *strdup __P((char *));
117 #endif
118
119 #ifdef NEED_STRERROR
120 extern  char            *strerror __P((int));
121 #endif
122
123 #ifdef NEED_FLOCK
124 extern  int             flock __P((int, int));
125 # define LOCK_SH 1
126 # define LOCK_EX 2
127 # define LOCK_NB 4
128 # define LOCK_UN 8
129 #endif
130
131 #ifdef NEED_SETSID
132 extern  int             setsid __P((void));
133 #endif
134
135 #ifdef NEED_GETDTABLESIZE
136 extern  int             getdtablesize __P((void));
137 #endif
138
139 #ifdef NEED_SETENV
140 extern  int             setenv __P((char *, char *, int));
141 #endif
142
143 #ifdef NEED_VFORK
144 extern  PID_T           vfork __P((void));
145 #endif