1 /* $NetBSD: l_stdlib.h,v 1.1.1.1 2009/12/13 16:54:49 kardel Exp $ */ 2 3 /* 4 * Proto types for machines that are not ANSI and POSIX compliant. 5 * This is optional 6 */ 7 8 #ifndef _l_stdlib_h 9 #define _l_stdlib_h 10 11 #ifdef HAVE_CONFIG_H 12 #include <config.h> 13 #endif 14 15 #ifdef HAVE_STDLIB_H 16 # include <stdlib.h> 17 #endif 18 19 #include <stdarg.h> 20 #include <sys/types.h> 21 22 /* Needed for speed_t. */ 23 #ifdef HAVE_TERMIOS_H 24 # include <termios.h> 25 #endif 26 27 #ifdef HAVE_ERRNO_H 28 # include <errno.h> 29 #endif 30 31 #include "ntp_types.h" 32 #include "ntp_proto.h" 33 34 /* Let's try to keep this more or less alphabetized... */ 35 36 #ifdef DECL_ADJTIME_0 37 struct timeval; 38 extern int adjtime (struct timeval *, struct timeval *); 39 #endif 40 41 #ifdef DECL_BCOPY_0 42 #ifndef bcopy 43 extern void bcopy (const char *, char *, int); 44 #endif 45 #endif 46 47 #ifdef DECL_BZERO_0 48 #ifndef bzero 49 extern void bzero (char *, int); 50 #endif 51 #endif 52 53 #ifdef DECL_CFSETISPEED_0 54 struct termios; 55 extern int cfsetispeed (struct termios *, speed_t); 56 extern int cfsetospeed (struct termios *, speed_t); 57 #endif 58 59 extern char * getpass (const char *); 60 61 #ifdef DECL_HSTRERROR_0 62 extern const char * hstrerror (int); 63 #endif 64 65 #ifdef DECL_INET_NTOA_0 66 struct in_addr; 67 extern char * inet_ntoa (struct in_addr); 68 #endif 69 70 #ifdef DECL_IOCTL_0 71 extern int ioctl (int, u_long, char *); 72 #endif 73 74 #ifdef DECL_IPC_0 75 struct sockaddr; 76 extern int bind (int, struct sockaddr *, int); 77 extern int connect (int, struct sockaddr *, int); 78 extern int recv (int, char *, int, int); 79 extern int recvfrom (int, char *, int, int, struct sockaddr *, int *); 80 extern int send (int, char *, int, int); 81 extern int sendto (int, char *, int, int, struct sockaddr *, int); 82 extern int setsockopt (int, int, int, char *, int); 83 extern int socket (int, int, int); 84 #endif 85 86 #ifdef DECL_MEMMOVE_0 87 extern void * memmove (void *, const void *, size_t); 88 #endif 89 90 #ifdef DECL_MEMSET_0 91 extern char * memset (char *, int, int); 92 #endif 93 94 #ifdef DECL_MKSTEMP_0 95 extern int mkstemp (char *); 96 #endif 97 98 #ifdef DECL_MKTEMP_0 99 extern char *mktemp (char *); 100 #endif 101 102 #ifdef DECL_NLIST_0 103 struct nlist; 104 extern int nlist (const char *, struct nlist *); 105 #endif 106 107 #ifdef DECL_PLOCK_0 108 extern int plock (int); 109 #endif 110 111 #ifdef DECL_RENAME_0 112 extern int rename (const char *, const char *); 113 #endif 114 115 #ifdef DECL_SELECT_0 116 #ifdef _ntp_select_h 117 extern int select (int, fd_set *, fd_set *, fd_set *, struct timeval *); 118 #endif 119 #endif 120 121 #ifdef DECL_SETITIMER_0 122 struct itimerval; 123 extern int setitimer (int , struct itimerval *, struct itimerval *); 124 #endif 125 126 #ifdef PRIO_PROCESS 127 #ifdef DECL_SETPRIORITY_0 128 extern int setpriority (int, int, int); 129 #endif 130 #ifdef DECL_SETPRIORITY_1 131 extern int setpriority (int, id_t, int); 132 #endif 133 #endif 134 135 #ifdef DECL_SIGVEC_0 136 struct sigvec; 137 extern int sigvec (int, struct sigvec *, struct sigvec *); 138 #endif 139 140 #ifndef HAVE_SNPRINTF 141 /* PRINTFLIKE3 */ 142 extern int snprintf (char *, size_t, const char *, ...); 143 #endif 144 145 /* HMS: does this need further protection? */ 146 #ifndef HAVE_VSNPRINTF 147 extern int vsnprintf (char *, size_t, const char *, va_list); 148 #endif 149 150 #ifdef DECL_STDIO_0 151 #if defined(FILE) || defined(BUFSIZ) 152 extern int _flsbuf (int, FILE *); 153 extern int _filbuf (FILE *); 154 extern int fclose (FILE *); 155 extern int fflush (FILE *); 156 extern int fprintf (FILE *, const char *, ...); 157 extern int fscanf (FILE *, const char *, ...); 158 extern int fputs (const char *, FILE *); 159 extern int fputc (int, FILE *); 160 extern int fread (char *, int, int, FILE *); 161 extern void perror (const char *); 162 extern int printf (const char *, ...); 163 extern int setbuf (FILE *, char *); 164 # ifdef HAVE_SETLINEBUF 165 extern int setlinebuf (FILE *); 166 # endif 167 extern int setvbuf (FILE *, char *, int, int); 168 extern int scanf (const char *, ...); 169 extern int sscanf (const char *, const char *, ...); 170 extern int vfprintf (FILE *, const char *, ...); 171 extern int vsprintf (char *, const char *, ...); 172 #endif 173 #endif 174 175 #ifdef DECL_STIME_0 176 extern int stime (const time_t *); 177 #endif 178 179 #ifdef DECL_STIME_1 180 extern int stime (long *); 181 #endif 182 183 #ifdef DECL_STRERROR_0 184 extern char * strerror (int errnum); 185 #endif 186 187 #ifdef DECL_STRTOL_0 188 extern long strtol (const char *, char **, int); 189 #endif 190 191 #ifdef DECL_SYSCALL 192 extern int syscall (int, ...); 193 #endif 194 195 #ifdef DECL_SYSLOG_0 196 extern void closelog (void); 197 #ifndef LOG_DAEMON 198 extern void openlog (const char *, int); 199 #else 200 extern void openlog (const char *, int, int); 201 #endif 202 extern int setlogmask (int); 203 extern void syslog (int, const char *, ...); 204 #endif 205 206 #ifdef DECL_TIME_0 207 extern time_t time (time_t *); 208 #endif 209 210 #ifdef DECL_TIMEOFDAY_0 211 #ifdef SYSV_TIMEOFDAY 212 extern int gettimeofday (struct timeval *); 213 extern int settimeofday (struct timeval *); 214 #else /* not SYSV_TIMEOFDAY */ 215 struct timezone; 216 extern int gettimeofday (struct timeval *, struct timezone *); 217 extern int settimeofday (struct timeval *, void *); 218 #endif /* not SYSV_TIMEOFDAY */ 219 #endif 220 221 #ifdef DECL_TOLOWER_0 222 extern int tolower (int); 223 #endif 224 225 #ifdef DECL_TOUPPER_0 226 extern int toupper (int); 227 #endif 228 229 /* 230 * Necessary variable declarations. 231 */ 232 #ifdef DECL_ERRNO 233 extern int errno; 234 #endif 235 236 #if defined(DECL_H_ERRNO) && !defined(h_errno) 237 extern int h_errno; 238 #endif 239 240 #endif /* l_stdlib_h */ 241