1 /* $NetBSD: externs.h,v 1.3 2020/04/18 19:32:19 christos Exp $ */ 2 3 /* Copyright 1993,1994 by Paul Vixie 4 * All rights reserved 5 */ 6 7 /* 8 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 9 * Copyright (c) 1997,2000 by Internet Software Consortium, Inc. 10 * 11 * Permission to use, copy, modify, and distribute this software for any 12 * purpose with or without fee is hereby granted, provided that the above 13 * copyright notice and this permission notice appear in all copies. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 16 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 17 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 18 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 21 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 */ 23 24 /* reorder these #include's at your peril */ 25 26 #include <sys/param.h> 27 #include <sys/types.h> 28 #include <sys/time.h> 29 #include <sys/wait.h> 30 #include <sys/fcntl.h> 31 #include <sys/file.h> 32 #include <sys/stat.h> 33 #include <sys/queue.h> 34 35 #include <bitstring.h> 36 #include <ctype.h> 37 #ifndef isascii 38 #define isascii(c) ((unsigned)(c)<=0177) 39 #endif 40 #include <dirent.h> 41 #include <errno.h> 42 #include <fcntl.h> 43 #include <grp.h> 44 #include <locale.h> 45 #include <pwd.h> 46 #include <err.h> 47 #include <signal.h> 48 #include <stdarg.h> 49 #include <stdio.h> 50 #include <stdlib.h> 51 #include <string.h> 52 #include <time.h> 53 #include <unistd.h> 54 #include <utime.h> 55 56 #if defined(SYSLOG) 57 # include <syslog.h> 58 #endif 59 60 #if defined(LOGIN_CAP) 61 # include <login_cap.h> 62 #endif /*LOGIN_CAP*/ 63 64 #if defined(BSD_AUTH) 65 # include <bsd_auth.h> 66 #endif /*BSD_AUTH*/ 67 68 #define DIR_T struct dirent 69 #define WAIT_T int 70 #define SIG_T sig_t 71 #define TIME_T time_t 72 #define PID_T pid_t 73 74 #define TZONE(tm) tzname[(tm).tm_isdst] 75 76 #if (defined(BSD)) && (BSD >= 198606) || defined(__linux) 77 # define HAVE_FCHOWN 78 # define HAVE_FCHMOD 79 #endif 80 81 #if (defined(BSD)) && (BSD >= 199103) || defined(__linux) 82 # define HAVE_SAVED_UIDS 83 #endif 84 85 #define MY_UID(pw) getuid() 86 #define MY_GID(pw) getgid() 87 88 /* getopt() isn't part of POSIX. some systems define it in <stdlib.h> anyway. 89 * of those that do, some complain that our definition is different and some 90 * do not. to add to the misery and confusion, some systems define getopt() 91 * in ways that we cannot predict or comprehend, yet do not define the adjunct 92 * external variables needed for the interface. 93 */ 94 #if (!defined(BSD) || (BSD < 198911)) 95 int getopt(int, char * const *, const char *); 96 #endif 97 98 #if (!defined(BSD) || (BSD < 199103)) 99 extern char *optarg; 100 extern int optind, opterr, optopt; 101 #endif 102 103 /* digital unix needs this but does not give us a way to identify it. 104 */ 105 extern int flock(int, int); 106 107 /* not all systems who provide flock() provide these definitions. 108 */ 109 #ifndef LOCK_SH 110 # define LOCK_SH 1 111 #endif 112 #ifndef LOCK_EX 113 # define LOCK_EX 2 114 #endif 115 #ifndef LOCK_NB 116 # define LOCK_NB 4 117 #endif 118 #ifndef LOCK_UN 119 # define LOCK_UN 8 120 #endif 121 122 #ifndef WCOREDUMP 123 # define WCOREDUMP(st) (((st) & 0200) != 0) 124 #endif 125