xref: /freebsd/contrib/ntp/include/l_stdlib.h (revision 1669d8afc64812c8d2d1d147ae1fd42ff441e1b1)
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_MRAND48_0
108 extern	long	mrand48		P((void));
109 #endif
110 
111 #ifdef DECL_NLIST_0
112 struct nlist;
113 extern int	nlist		P((const char *, struct nlist *));
114 #endif
115 
116 #ifdef DECL_PLOCK_0
117 extern	int	plock		P((int));
118 #endif
119 
120 #ifdef DECL_RENAME_0
121 extern	int	rename		P((const char *, const char *));
122 #endif
123 
124 #ifdef DECL_SELECT_0
125 #ifdef _ntp_select_h
126 extern	int	select		P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
127 #endif
128 #endif
129 
130 #ifdef DECL_SETITIMER_0
131 struct itimerval;
132 extern	int	setitimer	P((int , struct itimerval *, struct itimerval *));
133 #endif
134 
135 #ifdef PRIO_PROCESS
136 #ifdef DECL_SETPRIORITY_0
137 extern	int	setpriority	P((int, int, int));
138 #endif
139 #ifdef DECL_SETPRIORITY_1
140 extern	int	setpriority	P((int, id_t, int));
141 #endif
142 #endif
143 
144 #ifdef DECL_SIGVEC_0
145 struct sigvec;
146 extern	int	sigvec		P((int, struct sigvec *, struct sigvec *));
147 #endif
148 
149 #ifndef HAVE_SNPRINTF
150 /* PRINTFLIKE3 */
151 extern	int	snprintf	P((char *, size_t, const char *, ...));
152 #endif
153 
154 /* HMS: does this need further protection? */
155 #ifndef HAVE_VSNPRINTF
156 extern	int	vsnprintf	P((char *, size_t, const char *, va_list));
157 #endif
158 
159 #ifdef DECL_SRAND48_0
160 extern	void	srand48		P((long));
161 #endif
162 
163 #ifdef DECL_STDIO_0
164 #if defined(FILE) || defined(BUFSIZ)
165 extern	int	_flsbuf		P((int, FILE *));
166 extern	int	_filbuf		P((FILE *));
167 extern	int	fclose		P((FILE *));
168 extern	int	fflush		P((FILE *));
169 extern	int	fprintf		P((FILE *, const char *, ...));
170 extern	int	fscanf		P((FILE *, const char *, ...));
171 extern	int	fputs		P((const char *, FILE *));
172 extern	int	fputc		P((int, FILE *));
173 extern	int	fread		P((char *, int, int, FILE *));
174 extern	void	perror		P((const char *));
175 extern	int	printf		P((const char *, ...));
176 extern	int	setbuf		P((FILE *, char *));
177 # ifdef HAVE_SETLINEBUF
178 extern	int	setlinebuf	P((FILE *));
179 # endif
180 extern	int	setvbuf		P((FILE *, char *, int, int));
181 extern	int	scanf		P((const char *, ...));
182 extern	int	sscanf		P((const char *, const char *, ...));
183 extern	int	vfprintf	P((FILE *, const char *, ...));
184 extern	int	vsprintf	P((char *, const char *, ...));
185 #endif
186 #endif
187 
188 #ifdef DECL_STIME_0
189 extern	int	stime		P((const time_t *));
190 #endif
191 
192 #ifdef DECL_STIME_1
193 extern	int	stime		P((long *));
194 #endif
195 
196 #ifdef DECL_STRERROR_0
197 extern	char *	strerror		P((int errnum));
198 #endif
199 
200 #ifdef DECL_STRTOL_0
201 extern	long	strtol		P((const char *, char **, int));
202 #endif
203 
204 #ifdef DECL_SYSCALL
205 extern	int	syscall		P((int, ...));
206 #endif
207 
208 #ifdef DECL_SYSLOG_0
209 extern	void	closelog	P((void));
210 #ifndef LOG_DAEMON
211 extern	void	openlog		P((const char *, int));
212 #else
213 extern	void	openlog		P((const char *, int, int));
214 #endif
215 extern	int	setlogmask	P((int));
216 extern	void	syslog		P((int, const char *, ...));
217 #endif
218 
219 #ifdef DECL_TIME_0
220 extern	time_t	time		P((time_t *));
221 #endif
222 
223 #ifdef DECL_TIMEOFDAY_0
224 #ifdef SYSV_TIMEOFDAY
225 extern	int	gettimeofday	P((struct timeval *));
226 extern	int	settimeofday	P((struct timeval *));
227 #else /* not SYSV_TIMEOFDAY */
228 struct timezone;
229 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
230 extern	int	settimeofday	P((struct timeval *, void *));
231 #endif /* not SYSV_TIMEOFDAY */
232 #endif
233 
234 #ifdef DECL_TOLOWER_0
235 extern	int	tolower		P((int));
236 #endif
237 
238 #ifdef DECL_TOUPPER_0
239 extern	int	toupper		P((int));
240 #endif
241 
242 /*
243  * Necessary variable declarations.
244  */
245 #ifdef DECL_ERRNO
246 extern	int	errno;
247 #endif
248 
249 #if defined(DECL_H_ERRNO) && !defined(h_errno)
250 extern	int	h_errno;
251 #endif
252 
253 /*******************************************************/
254 
255 #if 0
256 /*
257  * Unprotoyped	library functions for SunOS 4.x.x
258  */
259 #ifdef SYS_SUNOS4
260 extern	void	closelog	P((void));
261 extern	void	openlog		P((char *, int, int));
262 extern	void	syslog		P((int, char *, ...));
263 extern	int	setlogmask	P((int));
264 
265 extern	char *	getpass		P((char *));
266 
267 extern	int	setpriority	P((int ,int ,int));
268 
269 extern	long	strtol		P((char *, char **, int));
270 
271 #if !defined(NTP_POSIX_SOURCE)
272 extern	int	atoi		P((char *));
273 extern	int	dup2		P((int, int));
274 extern	int	execve		P((char *, char **,char **));
275 extern	int	fork		P((void));
276 extern	int	getdtablesize	P((void));
277 extern	int	qsort		(void *, int , int,
278 				   int P((*compar)(void *, void *)));
279 extern	long	random		P((void));
280 extern	long	mrand48		P((void));
281 extern	int	setpgrp		P((int, int));
282 extern	void	srandom		P((unsigned int));
283 extern	void	bcopy		P((const char *, char *, int));
284 #endif
285 
286 #ifndef bzero			/* XXX macro prototyping clash */
287 extern	void	bzero		P((char *, int));
288 extern	int	bcmp		P((char *, char *, int));
289 extern	void	bcopy		P((const char *, char *, int));
290 #endif
291 extern	char   *mktemp		P((char *));
292 
293 extern	int	tolower		P((int));
294 
295 extern	int	isatty		P((int));
296 
297 extern	unsigned sleep		P((unsigned ));
298 extern	unsigned int alarm	P((unsigned int));
299 extern	int	pause		P((void));
300 
301 extern	int	getpid		P((void));
302 extern	int	getppid		P((void));
303 
304 extern	int	close		P((int));
305 extern	int	ioctl		P((int, int, char *));
306 extern	int	rename		P((char *, char *));
307 #if	0
308 extern	int	read		P((int, void *, size_t));
309 extern	int	write		P((int, const void *, size_t));
310 #endif
311 extern	int	unlink		P((const char *));
312 extern	int	link		P((const char *, const char *));
313 
314 #ifdef FILE
315 extern	int	fclose		P((FILE *));
316 extern	int	fflush		P((FILE *));
317 extern	int	fprintf		P((FILE *, char *, ...));
318 extern	int	fscanf		P((FILE *, char *, ...));
319 extern	int	fputs		P((char *, FILE *));
320 extern	int	fputc		P((char, FILE *));
321 extern	int	fread		P((char *, int, int, FILE *));
322 extern	int	printf		P((char *, ...));
323 extern	int	setbuf		P((FILE *, char *));
324 extern	int	setvbuf		P((FILE *, char *, int, int));
325 extern	int	scanf		P((char *, ...));
326 extern	int	sscanf		P((char *, char *, ...));
327 extern	int	vsprintf	P((char *, char *, ...));
328 extern	int	_flsbuf		P((int, FILE *));
329 extern	int	_filbuf		P((FILE *));
330 extern	void	perror		P((char *));
331 #ifdef HAVE_SETLINEBUF
332 extern	int	setlinebuf	P((FILE *));
333 #endif
334 #endif
335 
336 #ifdef	_ntp_string_h
337 #ifdef	NTP_POSIX_SOURCE	/* these are builtins */
338 #ifndef NTP_NEED_BOPS		/* but may be emulated by bops */
339 extern	char	*memcpy P(());
340 extern	char	*memset P(());
341 extern	int	memcmp P(());
342 #endif
343 #endif
344 #endif
345 
346 #ifdef	_sys_socket_h
347 extern	int	bind		P((int, struct sockaddr *, int));
348 extern	int	connect		P((int,	 struct sockaddr *, int));
349 extern	int	sendto		P((int, char *, int, int, struct sockaddr *, int));
350 extern	int	setsockopt	P((int, int, int, char *, int));
351 extern	int	socket		P((int, int, int));
352 extern	int	recvfrom	P((int, char *, int, int, struct sockaddr *, int *));
353 #endif /* _sys_socket_h */
354 
355 #ifdef _ntp_select_h
356 extern	int	select		P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
357 #endif
358 
359 #ifdef _sys_time_h
360 extern	int	adjtime		P((struct timeval *, struct timeval *));
361 extern	int	setitimer	P((int , struct itimerval *, struct itimerval *));
362 #ifdef SYSV_TIMEOFDAY
363 extern	int	gettimeofday	P((struct timeval *));
364 extern	int	settimeofday	P((struct timeval *));
365 #else /* ! SYSV_TIMEOFDAY */
366 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
367 extern	int	settimeofday	P((struct timeval *, struct timezone *));
368 #endif /* SYSV_TIMEOFDAY */
369 #endif /* _sys_time_h */
370 
371 #ifdef __time_h
372 extern	time_t	time		P((time_t *));
373 #endif
374 
375 #ifdef	__setjmp_h
376 extern	int	setjmp		P((jmp_buf));
377 extern	void	longjmp		P((jmp_buf, int));
378 #endif
379 
380 #ifdef _sys_resource_h
381 extern	int	getrusage	P((int, struct rusage *));
382 #endif
383 
384 #ifdef	_nlist_h
385 extern int	nlist		P((char *, struct nlist *));
386 #endif
387 
388 #endif /* SYS_SUNOS4 */
389 
390 /*
391  * Unprototyped library functions for DEC OSF/1
392  */
393 #ifdef SYS_DECOSF1
394 #ifndef _MACHINE_ENDIAN_H_
395 #define _MACHINE_ENDIAN_H_
396 extern u_short	htons		P((u_short));
397 extern u_short	ntohs		P((u_short));
398 extern u_int32	htonl		P((u_int32));
399 extern u_int32	ntohl		P((u_int32));
400 #endif /* _MACHINE_ENDIAN_H_ */
401 
402 /*
403 extern	char *	getpass		P((char *));
404 */
405 extern	char *	mktemp		P((char *));
406 #ifndef SYS_IX86OSF1
407 extern	int	ioctl		P((int, u_long, char *));
408 extern	void	bzero		P((char *, int));
409 #endif
410 
411 #ifdef SOCK_DGRAM
412 extern	int	bind		P((int, const struct sockaddr *, int));
413 extern	int	connect		P((int, const struct sockaddr *, int));
414 extern	int	socket		P((int, int, int));
415 extern	int	sendto		P((int, const void *, int, int, const struct sockaddr *, int));
416 extern	int	setsockopt	P((int, int, int, const void *, int));
417 extern	int	recvfrom	P((int, void *, int, int, struct sockaddr *, int *));
418 #endif /* SOCK_STREAM */
419 
420 #ifdef _ntp_select_h
421 extern	int	select		P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
422 #endif
423 
424 #endif /* DECOSF1 */
425 
426 /*
427  * Unprototyped library functions for Ultrix
428  */
429 #ifdef SYS_ULTRIX
430 extern	int	close		P((int));
431 extern	char *	getpass		P((char *));
432 extern	int	getpid		P((void));
433 extern	int	ioctl		P((int, int, char *));
434 extern	char   *mktemp		P((char *));
435 extern	int	unlink		P((const char *));
436 extern	int	link		P((const char *, const char *));
437 
438 extern	void	closelog	P((void));
439 extern	void	syslog		P((int, char *, ...));
440 #ifndef LOG_DAEMON
441 extern	void	openlog		P((char *, int));
442 #else
443 extern	void	openlog		P((char *, int, int));
444 #endif
445 
446 extern	int	setpriority	P((int ,int ,int ));
447 
448 #ifdef SOCK_DGRAM
449 extern	int	bind		P((int, struct sockaddr *, int));
450 extern	int	connect		P((int,	 struct sockaddr *, int));
451 extern	int	socket		P((int, int, int));
452 extern	int	sendto		P((int, char *, int, int, struct sockaddr *, int));
453 extern	int	setsockopt	P((int, int, int, char *, int));
454 extern	int	recvfrom	P((int, char *, int, int, struct sockaddr *, int *));
455 #endif /* SOCK_STREAM */
456 
457 #ifdef _TIME_H_
458 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
459 extern	int	settimeofday	P((struct timeval *, struct timezone *));
460 extern	int	adjtime		P((struct timeval *, struct timeval *));
461 extern	int	select		P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
462 extern	int	setitimer	P((int , struct itimerval *, struct itimerval *));
463 #endif /* _TIME_H_ */
464 
465 #ifdef	N_UNDF
466 extern int	nlist		P((char *, struct nlist *));
467 #endif
468 
469 #ifndef bzero			/* XXX macro prototyping clash */
470 extern	void	bzero		P((char *, int));
471 extern	int	bcmp		P((char *, char *, int));
472 extern	void	bcopy		P((const char *, char *, int));
473 #endif
474 
475 #ifndef NTP_POSIX_SOURCE
476 extern	int	atoi		P((char *));
477 extern	void	bzero		P((char *, int));
478 extern	int	bcmp		P((char *, char *, int));
479 extern	void	bcopy		P((const char *, char *, int));
480 extern	int	execve		P((char *, char **,char **));
481 extern	int	fork		P((void));
482 extern	int	getdtablesize	P((void));
483 extern	int	ran		P((void));
484 extern	int	rand		P((void));
485 extern	void	srand		P((unsigned int));
486 #ifdef _TIME_H_
487 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
488 extern	int	settimeofday	P((struct timeval *, struct timezone *));
489 #endif
490 #endif
491 
492 #ifdef _RESOURCE_H_
493 extern	int	getrusage	P((int, struct rusage *));
494 #endif
495 
496 #endif /* SYS_ULTRIX */
497 
498 #if defined(__convex__)
499 extern	char *	getpass		P((char *));
500 #endif
501 
502 #ifdef SYS_IRIX4
503 extern	char *	getpass		P((char *));
504 #endif /* IRIX4 */
505 
506 #ifdef SYS_VAX
507 extern	char *	getpass		P((char *));
508 #endif /* VAX */
509 
510 #ifdef SYS_DOMAINOS
511 extern	char *	getpass		P((char *));
512 #endif /* SYS_DOMAINOS */
513 
514 #ifdef SYS_BSD
515 #define	   IN_CLASSD(i)		   (((long)(i) & 0xf0000000) == 0xe0000000)
516 #endif
517 
518 #endif /* 0 */
519 #endif /* l_stdlib_h */
520