xref: /freebsd/contrib/ntp/include/l_stdlib.h (revision 6990ffd8a95caaba6858ad44ff1b3157d1efba8f)
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_HSTRERROR_0
61 extern	const char * hstrerror	P((int));
62 #endif
63 
64 #ifdef DECL_INET_NTOA_0
65 struct in_addr;
66 extern	char *	inet_ntoa	P((struct in_addr));
67 #endif
68 
69 #ifdef DECL_IOCTL_0
70 extern	int	ioctl		P((int, u_long, char *));
71 #endif
72 
73 #ifdef DECL_IPC_0
74 struct sockaddr;
75 extern	int	bind		P((int, struct sockaddr *, int));
76 extern	int	connect		P((int, struct sockaddr *, int));
77 extern	int	recv		P((int, char *, int, int));
78 extern	int	recvfrom	P((int, char *, int, int, struct sockaddr *, int *));
79 extern	int	send		P((int, char *, int, int));
80 extern	int	sendto		P((int, char *, int, int, struct sockaddr *, int));
81 extern	int	setsockopt	P((int, int, int, char *, int));
82 extern	int	socket		P((int, int, int));
83 #endif
84 
85 #ifdef DECL_MEMMOVE_0
86 extern	void *	memmove		P((void *, const void *, size_t));
87 #endif
88 
89 #ifdef DECL_MEMSET_0
90 extern	char *	memset		P((char *, int, int));
91 #endif
92 
93 #ifdef DECL_MKSTEMP_0
94 extern	int	mkstemp		P((char *));
95 #endif
96 
97 #ifdef DECL_MKTEMP_0
98 extern	char   *mktemp		P((char *));
99 #endif
100 
101 #ifdef DECL_MRAND48_0
102 extern	long	mrand48		P((void));
103 #endif
104 
105 #ifdef DECL_NLIST_0
106 struct nlist;
107 extern int	nlist		P((const char *, struct nlist *));
108 #endif
109 
110 #ifdef DECL_PLOCK_0
111 extern	int	plock		P((int));
112 #endif
113 
114 #ifdef DECL_RENAME_0
115 extern	int	rename		P((const char *, const char *));
116 #endif
117 
118 #ifdef DECL_SELECT_0
119 #ifdef _ntp_select_h
120 extern	int	select		P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
121 #endif
122 #endif
123 
124 #ifdef DECL_SETITIMER_0
125 struct itimerval;
126 extern	int	setitimer	P((int , struct itimerval *, struct itimerval *));
127 #endif
128 
129 #ifdef PRIO_PROCESS
130 #ifdef DECL_SETPRIORITY_0
131 extern	int	setpriority	P((int, int, int));
132 #endif
133 #ifdef DECL_SETPRIORITY_1
134 extern	int	setpriority	P((int, id_t, int));
135 #endif
136 #endif
137 
138 #ifdef DECL_SIGVEC_0
139 struct sigvec;
140 extern	int	sigvec		P((int, struct sigvec *, struct sigvec *));
141 #endif
142 
143 #ifndef HAVE_SNPRINTF
144 /* PRINTFLIKE3 */
145 extern	int	snprintf	P((char *, size_t, const char *, ...));
146 #endif
147 
148 #ifdef DECL_SRAND48_0
149 extern	void	srand48		P((long));
150 #endif
151 
152 #ifdef DECL_STDIO_0
153 #if defined(FILE) || defined(BUFSIZ)
154 extern	int	_flsbuf		P((int, FILE *));
155 extern	int	_filbuf		P((FILE *));
156 extern	int	fclose		P((FILE *));
157 extern	int	fflush		P((FILE *));
158 extern	int	fprintf		P((FILE *, const char *, ...));
159 extern	int	fscanf		P((FILE *, const char *, ...));
160 extern	int	fputs		P((const char *, FILE *));
161 extern	int	fputc		P((int, FILE *));
162 extern	int	fread		P((char *, int, int, FILE *));
163 extern	void	perror		P((const char *));
164 extern	int	printf		P((const char *, ...));
165 extern	int	setbuf		P((FILE *, char *));
166 # ifdef HAVE_SETLINEBUF
167 extern	int	setlinebuf	P((FILE *));
168 # endif
169 extern	int	setvbuf		P((FILE *, char *, int, int));
170 extern	int	scanf		P((const char *, ...));
171 extern	int	sscanf		P((const char *, const char *, ...));
172 extern	int	vfprintf	P((FILE *, const char *, ...));
173 extern	int	vsprintf	P((char *, const char *, ...));
174 #endif
175 #endif
176 
177 #ifdef DECL_STIME_0
178 extern	int	stime		P((const time_t *));
179 #endif
180 
181 #ifdef DECL_STIME_1
182 extern	int	stime		P((long *));
183 #endif
184 
185 #ifdef DECL_STRERROR_0
186 extern	char *	strerror		P((int errnum));
187 #endif
188 
189 #ifdef DECL_STRTOL_0
190 extern	long	strtol		P((const char *, char **, int));
191 #endif
192 
193 #ifdef DECL_SYSCALL
194 extern	int	syscall		P((int, ...));
195 #endif
196 
197 #ifdef DECL_SYSLOG_0
198 extern	void	closelog	P((void));
199 #ifndef LOG_DAEMON
200 extern	void	openlog		P((const char *, int));
201 #else
202 extern	void	openlog		P((const char *, int, int));
203 #endif
204 extern	int	setlogmask	P((int));
205 extern	void	syslog		P((int, const char *, ...));
206 #endif
207 
208 #ifdef DECL_TIME_0
209 extern	time_t	time		P((time_t *));
210 #endif
211 
212 #ifdef DECL_TIMEOFDAY_0
213 #ifdef SYSV_TIMEOFDAY
214 extern	int	gettimeofday	P((struct timeval *));
215 extern	int	settimeofday	P((struct timeval *));
216 #else /* not SYSV_TIMEOFDAY */
217 struct timezone;
218 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
219 extern	int	settimeofday	P((struct timeval *, void *));
220 #endif /* not SYSV_TIMEOFDAY */
221 #endif
222 
223 #ifdef DECL_TOLOWER_0
224 extern	int	tolower		P((int));
225 #endif
226 
227 #ifdef DECL_TOUPPER_0
228 extern	int	toupper		P((int));
229 #endif
230 
231 /*
232  * Necessary variable declarations.
233  */
234 #ifdef DECL_ERRNO
235 extern	int	errno;
236 #endif
237 
238 #ifdef DECL_H_ERRNO
239 extern	int	h_errno;
240 #endif
241 
242 /*******************************************************/
243 
244 #if 0
245 /*
246  * Unprotoyped	library functions for SunOS 4.x.x
247  */
248 #ifdef SYS_SUNOS4
249 extern	void	closelog	P((void));
250 extern	void	openlog		P((char *, int, int));
251 extern	void	syslog		P((int, char *, ...));
252 extern	int	setlogmask	P((int));
253 
254 extern	char *	getpass		P((char *));
255 
256 extern	int	setpriority	P((int ,int ,int));
257 
258 extern	long	strtol		P((char *, char **, int));
259 
260 #if !defined(NTP_POSIX_SOURCE)
261 extern	int	atoi		P((char *));
262 extern	int	dup2		P((int, int));
263 extern	int	execve		P((char *, char **,char **));
264 extern	int	fork		P((void));
265 extern	int	getdtablesize	P((void));
266 extern	int	qsort		(void *, int , int,
267 				   int P((*compar)(void *, void *)));
268 extern	long	random		P((void));
269 extern	long	mrand48		P((void));
270 extern	int	setpgrp		P((int, int));
271 extern	void	srandom		P((unsigned 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 extern	int	rand		P((void));
474 extern	void	srand		P((unsigned int));
475 #ifdef _TIME_H_
476 extern	int	gettimeofday	P((struct timeval *, struct timezone *));
477 extern	int	settimeofday	P((struct timeval *, struct timezone *));
478 #endif
479 #endif
480 
481 #ifdef _RESOURCE_H_
482 extern	int	getrusage	P((int, struct rusage *));
483 #endif
484 
485 #endif /* SYS_ULTRIX */
486 
487 #if defined(__convex__)
488 extern	char *	getpass		P((char *));
489 #endif
490 
491 #ifdef SYS_IRIX4
492 extern	char *	getpass		P((char *));
493 #endif /* IRIX4 */
494 
495 #ifdef SYS_VAX
496 extern	char *	getpass		P((char *));
497 #endif /* VAX */
498 
499 #ifdef SYS_DOMAINOS
500 extern	char *	getpass		P((char *));
501 #endif /* SYS_DOMAINOS */
502 
503 #ifdef SYS_BSD
504 #define	   IN_CLASSD(i)		   (((long)(i) & 0xf0000000) == 0xe0000000)
505 #endif
506 
507 #endif /* 0 */
508 #endif /* l_stdlib_h */
509