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