1 /* 2 * Proto types for machines that are not ANSI and POSIX compliant. 3 * This is optional 4 */ 5 6 #ifndef _l_stdlib_h 7 #define _l_stdlib_h 8 9 #ifdef HAVE_CONFIG_H 10 #include <config.h> 11 #endif 12 13 #ifdef HAVE_STDLIB_H 14 # include <stdlib.h> 15 #endif 16 17 #if defined(__STDC__) || defined(HAVE_STDARG_H) 18 # include <stdarg.h> 19 #else 20 # include <varargs.h> 21 #endif 22 23 #ifdef HAVE_SYS_TYPES_H 24 # include <sys/types.h> 25 #endif 26 27 /* Needed for speed_t. */ 28 #ifdef HAVE_TERMIOS_H 29 # include <termios.h> 30 #endif 31 32 #ifdef HAVE_ERRNO_H 33 # include <errno.h> 34 #endif 35 36 #include "ntp_types.h" 37 #include "ntp_proto.h" 38 39 /* Let's try to keep this more or less alphabetized... */ 40 41 #ifdef DECL_ADJTIME_0 42 struct timeval; 43 extern int adjtime P((struct timeval *, struct timeval *)); 44 #endif 45 46 #ifdef DECL_BCOPY_0 47 #ifndef bcopy 48 extern void bcopy P((const char *, char *, int)); 49 #endif 50 #endif 51 52 #ifdef DECL_BZERO_0 53 #ifndef bzero 54 extern void bzero P((char *, int)); 55 #endif 56 #endif 57 58 #ifdef DECL_CFSETISPEED_0 59 struct termios; 60 extern int cfsetispeed P((struct termios *, speed_t)); 61 extern int cfsetospeed P((struct termios *, speed_t)); 62 #endif 63 64 extern char * getpass P((const char *)); 65 66 #ifdef DECL_HSTRERROR_0 67 extern const char * hstrerror P((int)); 68 #endif 69 70 #ifdef DECL_INET_NTOA_0 71 struct in_addr; 72 extern char * inet_ntoa P((struct in_addr)); 73 #endif 74 75 #ifdef DECL_IOCTL_0 76 extern int ioctl P((int, u_long, char *)); 77 #endif 78 79 #ifdef DECL_IPC_0 80 struct sockaddr; 81 extern int bind P((int, struct sockaddr *, int)); 82 extern int connect P((int, struct sockaddr *, int)); 83 extern int recv P((int, char *, int, int)); 84 extern int recvfrom P((int, char *, int, int, struct sockaddr *, int *)); 85 extern int send P((int, char *, int, int)); 86 extern int sendto P((int, char *, int, int, struct sockaddr *, int)); 87 extern int setsockopt P((int, int, int, char *, int)); 88 extern int socket P((int, int, int)); 89 #endif 90 91 #ifdef DECL_MEMMOVE_0 92 extern void * memmove P((void *, const void *, size_t)); 93 #endif 94 95 #ifdef DECL_MEMSET_0 96 extern char * memset P((char *, int, int)); 97 #endif 98 99 #ifdef DECL_MKSTEMP_0 100 extern int mkstemp P((char *)); 101 #endif 102 103 #ifdef DECL_MKTEMP_0 104 extern char *mktemp P((char *)); 105 #endif 106 107 #ifdef DECL_NLIST_0 108 struct nlist; 109 extern int nlist P((const char *, struct nlist *)); 110 #endif 111 112 #ifdef DECL_PLOCK_0 113 extern int plock P((int)); 114 #endif 115 116 #ifdef DECL_RENAME_0 117 extern int rename P((const char *, const char *)); 118 #endif 119 120 #ifdef DECL_SELECT_0 121 #ifdef _ntp_select_h 122 extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); 123 #endif 124 #endif 125 126 #ifdef DECL_SETITIMER_0 127 struct itimerval; 128 extern int setitimer P((int , struct itimerval *, struct itimerval *)); 129 #endif 130 131 #ifdef PRIO_PROCESS 132 #ifdef DECL_SETPRIORITY_0 133 extern int setpriority P((int, int, int)); 134 #endif 135 #ifdef DECL_SETPRIORITY_1 136 extern int setpriority P((int, id_t, int)); 137 #endif 138 #endif 139 140 #ifdef DECL_SIGVEC_0 141 struct sigvec; 142 extern int sigvec P((int, struct sigvec *, struct sigvec *)); 143 #endif 144 145 #ifndef HAVE_SNPRINTF 146 /* PRINTFLIKE3 */ 147 extern int snprintf P((char *, size_t, const char *, ...)); 148 #endif 149 150 /* HMS: does this need further protection? */ 151 #ifndef HAVE_VSNPRINTF 152 extern int vsnprintf P((char *, size_t, const char *, va_list)); 153 #endif 154 155 #ifdef DECL_STDIO_0 156 #if defined(FILE) || defined(BUFSIZ) 157 extern int _flsbuf P((int, FILE *)); 158 extern int _filbuf P((FILE *)); 159 extern int fclose P((FILE *)); 160 extern int fflush P((FILE *)); 161 extern int fprintf P((FILE *, const char *, ...)); 162 extern int fscanf P((FILE *, const char *, ...)); 163 extern int fputs P((const char *, FILE *)); 164 extern int fputc P((int, FILE *)); 165 extern int fread P((char *, int, int, FILE *)); 166 extern void perror P((const char *)); 167 extern int printf P((const char *, ...)); 168 extern int setbuf P((FILE *, char *)); 169 # ifdef HAVE_SETLINEBUF 170 extern int setlinebuf P((FILE *)); 171 # endif 172 extern int setvbuf P((FILE *, char *, int, int)); 173 extern int scanf P((const char *, ...)); 174 extern int sscanf P((const char *, const char *, ...)); 175 extern int vfprintf P((FILE *, const char *, ...)); 176 extern int vsprintf P((char *, const char *, ...)); 177 #endif 178 #endif 179 180 #ifdef DECL_STIME_0 181 extern int stime P((const time_t *)); 182 #endif 183 184 #ifdef DECL_STIME_1 185 extern int stime P((long *)); 186 #endif 187 188 #ifdef DECL_STRERROR_0 189 extern char * strerror P((int errnum)); 190 #endif 191 192 #ifdef DECL_STRTOL_0 193 extern long strtol P((const char *, char **, int)); 194 #endif 195 196 #ifdef DECL_SYSCALL 197 extern int syscall P((int, ...)); 198 #endif 199 200 #ifdef DECL_SYSLOG_0 201 extern void closelog P((void)); 202 #ifndef LOG_DAEMON 203 extern void openlog P((const char *, int)); 204 #else 205 extern void openlog P((const char *, int, int)); 206 #endif 207 extern int setlogmask P((int)); 208 extern void syslog P((int, const char *, ...)); 209 #endif 210 211 #ifdef DECL_TIME_0 212 extern time_t time P((time_t *)); 213 #endif 214 215 #ifdef DECL_TIMEOFDAY_0 216 #ifdef SYSV_TIMEOFDAY 217 extern int gettimeofday P((struct timeval *)); 218 extern int settimeofday P((struct timeval *)); 219 #else /* not SYSV_TIMEOFDAY */ 220 struct timezone; 221 extern int gettimeofday P((struct timeval *, struct timezone *)); 222 extern int settimeofday P((struct timeval *, void *)); 223 #endif /* not SYSV_TIMEOFDAY */ 224 #endif 225 226 #ifdef DECL_TOLOWER_0 227 extern int tolower P((int)); 228 #endif 229 230 #ifdef DECL_TOUPPER_0 231 extern int toupper P((int)); 232 #endif 233 234 /* 235 * Necessary variable declarations. 236 */ 237 #ifdef DECL_ERRNO 238 extern int errno; 239 #endif 240 241 #if defined(DECL_H_ERRNO) && !defined(h_errno) 242 extern int h_errno; 243 #endif 244 245 /*******************************************************/ 246 247 #if 0 248 /* 249 * Unprotoyped library functions for SunOS 4.x.x 250 */ 251 #ifdef SYS_SUNOS4 252 extern void closelog P((void)); 253 extern void openlog P((char *, int, int)); 254 extern void syslog P((int, char *, ...)); 255 extern int setlogmask P((int)); 256 257 extern char * getpass P((char *)); 258 259 extern int setpriority P((int ,int ,int)); 260 261 extern long strtol P((char *, char **, int)); 262 263 #if !defined(NTP_POSIX_SOURCE) 264 extern int atoi P((char *)); 265 extern int dup2 P((int, int)); 266 extern int execve P((char *, char **,char **)); 267 extern int fork P((void)); 268 extern int getdtablesize P((void)); 269 extern int qsort (void *, int , int, 270 int P((*compar)(void *, void *))); 271 extern int setpgrp P((int, int)); 272 extern void bcopy P((const char *, char *, int)); 273 #endif 274 275 #ifndef bzero /* XXX macro prototyping clash */ 276 extern void bzero P((char *, int)); 277 extern int bcmp P((char *, char *, int)); 278 extern void bcopy P((const char *, char *, int)); 279 #endif 280 extern char *mktemp P((char *)); 281 282 extern int tolower P((int)); 283 284 extern int isatty P((int)); 285 286 extern unsigned sleep P((unsigned )); 287 extern unsigned int alarm P((unsigned int)); 288 extern int pause P((void)); 289 290 extern int getpid P((void)); 291 extern int getppid P((void)); 292 293 extern int close P((int)); 294 extern int ioctl P((int, int, char *)); 295 extern int rename P((char *, char *)); 296 #if 0 297 extern int read P((int, void *, size_t)); 298 extern int write P((int, const void *, size_t)); 299 #endif 300 extern int unlink P((const char *)); 301 extern int link P((const char *, const char *)); 302 303 #ifdef FILE 304 extern int fclose P((FILE *)); 305 extern int fflush P((FILE *)); 306 extern int fprintf P((FILE *, char *, ...)); 307 extern int fscanf P((FILE *, char *, ...)); 308 extern int fputs P((char *, FILE *)); 309 extern int fputc P((char, FILE *)); 310 extern int fread P((char *, int, int, FILE *)); 311 extern int printf P((char *, ...)); 312 extern int setbuf P((FILE *, char *)); 313 extern int setvbuf P((FILE *, char *, int, int)); 314 extern int scanf P((char *, ...)); 315 extern int sscanf P((char *, char *, ...)); 316 extern int vsprintf P((char *, char *, ...)); 317 extern int _flsbuf P((int, FILE *)); 318 extern int _filbuf P((FILE *)); 319 extern void perror P((char *)); 320 #ifdef HAVE_SETLINEBUF 321 extern int setlinebuf P((FILE *)); 322 #endif 323 #endif 324 325 #ifdef _ntp_string_h 326 #ifdef NTP_POSIX_SOURCE /* these are builtins */ 327 #ifndef NTP_NEED_BOPS /* but may be emulated by bops */ 328 extern char *memcpy P(()); 329 extern char *memset P(()); 330 extern int memcmp P(()); 331 #endif 332 #endif 333 #endif 334 335 #ifdef _sys_socket_h 336 extern int bind P((int, struct sockaddr *, int)); 337 extern int connect P((int, struct sockaddr *, int)); 338 extern int sendto P((int, char *, int, int, struct sockaddr *, int)); 339 extern int setsockopt P((int, int, int, char *, int)); 340 extern int socket P((int, int, int)); 341 extern int recvfrom P((int, char *, int, int, struct sockaddr *, int *)); 342 #endif /* _sys_socket_h */ 343 344 #ifdef _ntp_select_h 345 extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); 346 #endif 347 348 #ifdef _sys_time_h 349 extern int adjtime P((struct timeval *, struct timeval *)); 350 extern int setitimer P((int , struct itimerval *, struct itimerval *)); 351 #ifdef SYSV_TIMEOFDAY 352 extern int gettimeofday P((struct timeval *)); 353 extern int settimeofday P((struct timeval *)); 354 #else /* ! SYSV_TIMEOFDAY */ 355 extern int gettimeofday P((struct timeval *, struct timezone *)); 356 extern int settimeofday P((struct timeval *, struct timezone *)); 357 #endif /* SYSV_TIMEOFDAY */ 358 #endif /* _sys_time_h */ 359 360 #ifdef __time_h 361 extern time_t time P((time_t *)); 362 #endif 363 364 #ifdef __setjmp_h 365 extern int setjmp P((jmp_buf)); 366 extern void longjmp P((jmp_buf, int)); 367 #endif 368 369 #ifdef _sys_resource_h 370 extern int getrusage P((int, struct rusage *)); 371 #endif 372 373 #ifdef _nlist_h 374 extern int nlist P((char *, struct nlist *)); 375 #endif 376 377 #endif /* SYS_SUNOS4 */ 378 379 /* 380 * Unprototyped library functions for DEC OSF/1 381 */ 382 #ifdef SYS_DECOSF1 383 #ifndef _MACHINE_ENDIAN_H_ 384 #define _MACHINE_ENDIAN_H_ 385 extern u_short htons P((u_short)); 386 extern u_short ntohs P((u_short)); 387 extern u_int32 htonl P((u_int32)); 388 extern u_int32 ntohl P((u_int32)); 389 #endif /* _MACHINE_ENDIAN_H_ */ 390 391 /* 392 extern char * getpass P((char *)); 393 */ 394 extern char * mktemp P((char *)); 395 #ifndef SYS_IX86OSF1 396 extern int ioctl P((int, u_long, char *)); 397 extern void bzero P((char *, int)); 398 #endif 399 400 #ifdef SOCK_DGRAM 401 extern int bind P((int, const struct sockaddr *, int)); 402 extern int connect P((int, const struct sockaddr *, int)); 403 extern int socket P((int, int, int)); 404 extern int sendto P((int, const void *, int, int, const struct sockaddr *, int)); 405 extern int setsockopt P((int, int, int, const void *, int)); 406 extern int recvfrom P((int, void *, int, int, struct sockaddr *, int *)); 407 #endif /* SOCK_STREAM */ 408 409 #ifdef _ntp_select_h 410 extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); 411 #endif 412 413 #endif /* DECOSF1 */ 414 415 /* 416 * Unprototyped library functions for Ultrix 417 */ 418 #ifdef SYS_ULTRIX 419 extern int close P((int)); 420 extern char * getpass P((char *)); 421 extern int getpid P((void)); 422 extern int ioctl P((int, int, char *)); 423 extern char *mktemp P((char *)); 424 extern int unlink P((const char *)); 425 extern int link P((const char *, const char *)); 426 427 extern void closelog P((void)); 428 extern void syslog P((int, char *, ...)); 429 #ifndef LOG_DAEMON 430 extern void openlog P((char *, int)); 431 #else 432 extern void openlog P((char *, int, int)); 433 #endif 434 435 extern int setpriority P((int ,int ,int )); 436 437 #ifdef SOCK_DGRAM 438 extern int bind P((int, struct sockaddr *, int)); 439 extern int connect P((int, struct sockaddr *, int)); 440 extern int socket P((int, int, int)); 441 extern int sendto P((int, char *, int, int, struct sockaddr *, int)); 442 extern int setsockopt P((int, int, int, char *, int)); 443 extern int recvfrom P((int, char *, int, int, struct sockaddr *, int *)); 444 #endif /* SOCK_STREAM */ 445 446 #ifdef _TIME_H_ 447 extern int gettimeofday P((struct timeval *, struct timezone *)); 448 extern int settimeofday P((struct timeval *, struct timezone *)); 449 extern int adjtime P((struct timeval *, struct timeval *)); 450 extern int select P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); 451 extern int setitimer P((int , struct itimerval *, struct itimerval *)); 452 #endif /* _TIME_H_ */ 453 454 #ifdef N_UNDF 455 extern int nlist P((char *, struct nlist *)); 456 #endif 457 458 #ifndef bzero /* XXX macro prototyping clash */ 459 extern void bzero P((char *, int)); 460 extern int bcmp P((char *, char *, int)); 461 extern void bcopy P((const char *, char *, int)); 462 #endif 463 464 #ifndef NTP_POSIX_SOURCE 465 extern int atoi P((char *)); 466 extern void bzero P((char *, int)); 467 extern int bcmp P((char *, char *, int)); 468 extern void bcopy P((const char *, char *, int)); 469 extern int execve P((char *, char **,char **)); 470 extern int fork P((void)); 471 extern int getdtablesize P((void)); 472 extern int ran P((void)); 473 #ifdef _TIME_H_ 474 extern int gettimeofday P((struct timeval *, struct timezone *)); 475 extern int settimeofday P((struct timeval *, struct timezone *)); 476 #endif 477 #endif 478 479 #ifdef _RESOURCE_H_ 480 extern int getrusage P((int, struct rusage *)); 481 #endif 482 483 #endif /* SYS_ULTRIX */ 484 485 #if defined(__convex__) 486 extern char * getpass P((char *)); 487 #endif 488 489 #ifdef SYS_IRIX4 490 extern char * getpass P((char *)); 491 #endif /* IRIX4 */ 492 493 #ifdef SYS_VAX 494 extern char * getpass P((char *)); 495 #endif /* VAX */ 496 497 #ifdef SYS_DOMAINOS 498 extern char * getpass P((char *)); 499 #endif /* SYS_DOMAINOS */ 500 501 #ifdef SYS_BSD 502 #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) 503 #endif 504 505 #endif /* 0 */ 506 #endif /* l_stdlib_h */ 507