1173412Skevlo/* $FreeBSD: releng/10.3/usr.sbin/cron/cron/externs.h 173412 2007-11-07 10:53:41Z kevlo $ */ 2173412Skevlo 32311Sjkh/* Copyright 1993,1994 by Paul Vixie 42311Sjkh * All rights reserved 52311Sjkh * 62311Sjkh * Distribute freely, except: don't remove my name from the source or 72311Sjkh * documentation (don't take credit for my work), mark your changes (don't 82311Sjkh * get me blamed for your possible bugs), don't alter or remove this 92311Sjkh * notice. May be sold if buildable source is provided to buyer. No 102311Sjkh * warrantee of any kind, express or implied, is included with this 112311Sjkh * software; use at your own risk, responsibility for damages (if any) to 122311Sjkh * anyone resulting from the use of this software rests entirely with the 132311Sjkh * user. 142311Sjkh * 152311Sjkh * Send bug reports, bug fixes, enhancements, requests, flames, etc., and 162311Sjkh * I'll try to keep a version up to date. I can be reached as follows: 172311Sjkh * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul 182311Sjkh */ 192311Sjkh 202311Sjkh#if defined(POSIX) || defined(ATT) 212311Sjkh# include <stdlib.h> 222311Sjkh# include <unistd.h> 232311Sjkh# include <string.h> 242311Sjkh# include <dirent.h> 252311Sjkh# define DIR_T struct dirent 262311Sjkh# define WAIT_T int 272311Sjkh# define WAIT_IS_INT 1 282311Sjkhextern char *tzname[2]; 292311Sjkh# define TZONE(tm) tzname[(tm).tm_isdst] 302311Sjkh#endif 312311Sjkh 322311Sjkh#if defined(UNIXPC) 332311Sjkh# undef WAIT_T 342311Sjkh# undef WAIT_IS_INT 352311Sjkh# define WAIT_T union wait 362311Sjkh#endif 372311Sjkh 382311Sjkh#if defined(POSIX) 392311Sjkh# define SIG_T sig_t 402311Sjkh# define TIME_T time_t 412311Sjkh# define PID_T pid_t 422311Sjkh#endif 432311Sjkh 442311Sjkh#if defined(ATT) 452311Sjkh# define SIG_T void 462311Sjkh# define TIME_T long 472311Sjkh# define PID_T int 482311Sjkh#endif 492311Sjkh 502311Sjkh#if !defined(POSIX) && !defined(ATT) 512311Sjkh/* classic BSD */ 522311Sjkhextern time_t time(); 532311Sjkhextern unsigned sleep(); 542311Sjkhextern struct tm *localtime(); 552311Sjkhextern struct passwd *getpwnam(); 562311Sjkhextern int errno; 572311Sjkhextern void perror(), exit(), free(); 582311Sjkhextern char *getenv(), *strcpy(), *strchr(), *strtok(); 592311Sjkhextern void *malloc(), *realloc(); 602311Sjkh# define SIG_T void 612311Sjkh# define TIME_T long 622311Sjkh# define PID_T int 632311Sjkh# define WAIT_T union wait 642311Sjkh# define DIR_T struct direct 652311Sjkh# include <sys/dir.h> 662311Sjkh# define TZONE(tm) (tm).tm_zone 672311Sjkh#endif 682311Sjkh 692311Sjkh/* getopt() isn't part of POSIX. some systems define it in <stdlib.h> anyway. 702311Sjkh * of those that do, some complain that our definition is different and some 712311Sjkh * do not. to add to the misery and confusion, some systems define getopt() 722311Sjkh * in ways that we cannot predict or comprehend, yet do not define the adjunct 732311Sjkh * external variables needed for the interface. 742311Sjkh */ 752311Sjkh#if (!defined(BSD) || (BSD < 198911)) && !defined(ATT) && !defined(UNICOS) 76173412Skevloint getopt(int, char * const *, const char *); 772311Sjkh#endif 782311Sjkh 792311Sjkh#if (!defined(BSD) || (BSD < 199103)) 802311Sjkhextern char *optarg; 812311Sjkhextern int optind, opterr, optopt; 822311Sjkh#endif 832311Sjkh 842311Sjkh#if WAIT_IS_INT 852311Sjkh# ifndef WEXITSTATUS 862311Sjkh# define WEXITSTATUS(x) (((x) >> 8) & 0xff) 872311Sjkh# endif 882311Sjkh# ifndef WTERMSIG 892311Sjkh# define WTERMSIG(x) ((x) & 0x7f) 902311Sjkh# endif 912311Sjkh# ifndef WCOREDUMP 922311Sjkh# define WCOREDUMP(x) ((x) & 0x80) 932311Sjkh# endif 942311Sjkh#else /*WAIT_IS_INT*/ 952311Sjkh# ifndef WEXITSTATUS 962311Sjkh# define WEXITSTATUS(x) ((x).w_retcode) 972311Sjkh# endif 982311Sjkh# ifndef WTERMSIG 992311Sjkh# define WTERMSIG(x) ((x).w_termsig) 1002311Sjkh# endif 1012311Sjkh# ifndef WCOREDUMP 1022311Sjkh# define WCOREDUMP(x) ((x).w_coredump) 1032311Sjkh# endif 1042311Sjkh#endif /*WAIT_IS_INT*/ 1052311Sjkh 1062311Sjkh#ifndef WIFSIGNALED 1072311Sjkh#define WIFSIGNALED(x) (WTERMSIG(x) != 0) 1082311Sjkh#endif 1092311Sjkh#ifndef WIFEXITED 1102311Sjkh#define WIFEXITED(x) (WTERMSIG(x) == 0) 1112311Sjkh#endif 1122311Sjkh 1132311Sjkh#ifdef NEED_STRCASECMP 114173412Skevloextern int strcasecmp(char *, char *); 1152311Sjkh#endif 1162311Sjkh 1172311Sjkh#ifdef NEED_STRDUP 118173412Skevloextern char *strdup(char *); 1192311Sjkh#endif 1202311Sjkh 1212311Sjkh#ifdef NEED_STRERROR 122173412Skevloextern char *strerror(int); 1232311Sjkh#endif 1242311Sjkh 1252311Sjkh#ifdef NEED_FLOCK 126173412Skevloextern int flock(int, int); 1272311Sjkh# define LOCK_SH 1 1282311Sjkh# define LOCK_EX 2 1292311Sjkh# define LOCK_NB 4 1302311Sjkh# define LOCK_UN 8 1312311Sjkh#endif 1322311Sjkh 1332311Sjkh#ifdef NEED_SETSID 134173412Skevloextern int setsid(void); 1352311Sjkh#endif 1362311Sjkh 1372311Sjkh#ifdef NEED_GETDTABLESIZE 138173412Skevloextern int getdtablesize(void); 1392311Sjkh#endif 1402311Sjkh 1412311Sjkh#ifdef NEED_SETENV 142173412Skevloextern int setenv(char *, char *, int); 1432311Sjkh#endif 1442311Sjkh 1452311Sjkh#ifdef NEED_VFORK 146173412Skevloextern PID_T vfork(void); 1472311Sjkh#endif 148