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