summaryrefslogtreecommitdiff
path: root/usr.sbin/cron/externs.h
blob: 5d1043022799d87a2a5e7abad37b19eadf92c412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* Copyright 1993,1994 by Paul Vixie
 * All rights reserved
 *
 * Distribute freely, except: don't remove my name from the source or
 * documentation (don't take credit for my work), mark your changes (don't
 * get me blamed for your possible bugs), don't alter or remove this
 * notice.  May be sold if buildable source is provided to buyer.  No
 * warrantee of any kind, express or implied, is included with this
 * software; use at your own risk, responsibility for damages (if any) to
 * anyone resulting from the use of this software rests entirely with the
 * user.
 *
 * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
 * I'll try to keep a version up to date.  I can be reached as follows:
 * Paul Vixie          <paul@vix.com>          uunet!decwrl!vixie!paul
 */

#if defined(POSIX) || defined(ATT)
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <dirent.h>
# include <errno.h>
# define DIR_T	struct dirent
# define WAIT_T	int
# define WAIT_IS_INT 1
extern char *tzname[2];
# define TZONE(tm) tzname[(tm).tm_isdst]
#endif

#if defined(UNIXPC)
# undef WAIT_T
# undef WAIT_IS_INT
# define WAIT_T	union wait
#endif

#if defined(POSIX)
# define SIG_T	sig_t
# define TIME_T	time_t
# define PID_T pid_t
#endif

#if defined(ATT)
# define SIG_T	void
# define TIME_T	long
# define PID_T int
#endif

#if !defined(POSIX) && !defined(ATT)
/* classic BSD */
extern	time_t		time();
extern	unsigned	sleep();
extern	struct tm	*localtime();
extern	struct passwd	*getpwnam();
extern	int		errno;
extern	void		perror(), exit(), free();
extern	char		*getenv(), *strcpy(), *strchr(), *strtok();
extern	void		*malloc(), *realloc();
# define SIG_T	void
# define TIME_T	long
# define PID_T int
# define WAIT_T	union wait
# define DIR_T	struct direct
# include <sys/dir.h>
# define TZONE(tm) (tm).tm_zone
#endif

/* getopt() isn't part of POSIX.  some systems define it in <stdlib.h> anyway.
 * of those that do, some complain that our definition is different and some
 * do not.  to add to the misery and confusion, some systems define getopt()
 * in ways that we cannot predict or comprehend, yet do not define the adjunct
 * external variables needed for the interface.
 */
#if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS)
int	getopt __P((int, char * const *, const char *));
#endif

#if (!defined(BSD) || (BSD < 199103))
extern	char *optarg;
extern	int optind, opterr, optopt;
#endif

#if WAIT_IS_INT
# ifndef WEXITSTATUS
#  define WEXITSTATUS(x) (((x) >> 8) & 0xff)
# endif
# ifndef WTERMSIG
#  define WTERMSIG(x)	((x) & 0x7f)
# endif
# ifndef WCOREDUMP
#  define WCOREDUMP(x)	((x) & 0x80)
# endif
#else /*WAIT_IS_INT*/
# ifndef WEXITSTATUS
#  define WEXITSTATUS(x) ((x).w_retcode)
# endif
# ifndef WTERMSIG
#  define WTERMSIG(x)	((x).w_termsig)
# endif
# ifndef WCOREDUMP
#  define WCOREDUMP(x)	((x).w_coredump)
# endif
#endif /*WAIT_IS_INT*/

#ifndef WIFSIGNALED
#define WIFSIGNALED(x)	(WTERMSIG(x) != 0)
#endif
#ifndef WIFEXITED
#define WIFEXITED(x)	(WTERMSIG(x) == 0)
#endif

#ifdef NEED_STRCASECMP
extern	int		strcasecmp __P((char *, char *));
#endif

#ifdef NEED_STRDUP
extern	char		*strdup __P((char *));
#endif

#ifdef NEED_STRERROR
extern	char		*strerror __P((int));
#endif

#ifdef NEED_FLOCK
extern	int		flock __P((int, int));
# define LOCK_SH 1
# define LOCK_EX 2
# define LOCK_NB 4
# define LOCK_UN 8
#endif

#ifdef NEED_SETSID
extern	int		setsid __P((void));
#endif

#ifdef NEED_GETDTABLESIZE
extern	int		getdtablesize __P((void));
#endif

#ifdef NEED_SETENV
extern	int		setenv __P((char *, char *, int));
#endif

#ifdef NEED_VFORK
extern	PID_T		vfork __P((void));
#endif