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#include <stdarg.h>
18#include <sys/types.h>
19
20/* Needed for speed_t. */
21#ifdef HAVE_TERMIOS_H
22# include <termios.h>
23#endif
24
25#ifdef HAVE_ERRNO_H
26# include <errno.h>
27#endif
28
29#include "ntp_types.h"
30#include "ntp_proto.h"
31
32/* Let's try to keep this more or less alphabetized... */
33
34#ifdef DECL_ADJTIME_0
35struct timeval;
36extern	int	adjtime		(struct timeval *, struct timeval *);
37#endif
38
39#ifdef DECL_BCOPY_0
40#ifndef bcopy
41extern	void	bcopy		(const char *, char *, int);
42#endif
43#endif
44
45#ifdef DECL_BZERO_0
46#ifndef bzero
47extern	void	bzero		(char *, int);
48#endif
49#endif
50
51#ifdef DECL_CFSETISPEED_0
52struct termios;
53extern	int	cfsetispeed	(struct termios *, speed_t);
54extern	int	cfsetospeed	(struct termios *, speed_t);
55#endif
56
57extern	char *	getpass		(const char *);
58
59#ifdef DECL_HSTRERROR_0
60extern	const char * hstrerror	(int);
61#endif
62
63#ifdef DECL_INET_NTOA_0
64struct in_addr;
65extern	char *	inet_ntoa	(struct in_addr);
66#endif
67
68#ifdef DECL_IOCTL_0
69extern	int	ioctl		(int, u_long, char *);
70#endif
71
72#ifdef DECL_IPC_0
73struct sockaddr;
74extern	int	bind		(int, struct sockaddr *, int);
75extern	int	connect		(int, struct sockaddr *, int);
76extern	int	recv		(int, char *, int, int);
77extern	int	recvfrom	(int, char *, int, int, struct sockaddr *, int *);
78extern	int	send		(int, char *, int, int);
79extern	int	sendto		(int, char *, int, int, struct sockaddr *, int);
80extern	int	setsockopt	(int, int, int, char *, int);
81extern	int	socket		(int, int, int);
82#endif
83
84#ifdef DECL_MEMMOVE_0
85extern	void *	memmove		(void *, const void *, size_t);
86#endif
87
88#ifdef DECL_MEMSET_0
89extern	char *	memset		(char *, int, int);
90#endif
91
92#ifdef DECL_MKSTEMP_0
93extern	int	mkstemp		(char *);
94#endif
95
96#ifdef DECL_MKTEMP_0
97extern	char   *mktemp		(char *);
98#endif
99
100#ifdef DECL_NLIST_0
101struct nlist;
102extern int	nlist		(const char *, struct nlist *);
103#endif
104
105#ifdef DECL_PLOCK_0
106extern	int	plock		(int);
107#endif
108
109#ifdef DECL_RENAME_0
110extern	int	rename		(const char *, const char *);
111#endif
112
113#ifdef DECL_SELECT_0
114#ifdef _ntp_select_h
115extern	int	select		(int, fd_set *, fd_set *, fd_set *, struct timeval *);
116#endif
117#endif
118
119#ifdef DECL_SETITIMER_0
120struct itimerval;
121extern	int	setitimer	(int , struct itimerval *, struct itimerval *);
122#endif
123
124#ifdef PRIO_PROCESS
125#ifdef DECL_SETPRIORITY_0
126extern	int	setpriority	(int, int, int);
127#endif
128#ifdef DECL_SETPRIORITY_1
129extern	int	setpriority	(int, id_t, int);
130#endif
131#endif
132
133#ifdef DECL_SIGVEC_0
134struct sigvec;
135extern	int	sigvec		(int, struct sigvec *, struct sigvec *);
136#endif
137
138#ifndef HAVE_SNPRINTF
139/* PRINTFLIKE3 */
140extern	int	snprintf	(char *, size_t, const char *, ...);
141#endif
142
143/* HMS: does this need further protection? */
144#ifndef HAVE_VSNPRINTF
145extern	int	vsnprintf	(char *, size_t, const char *, va_list);
146#endif
147
148#ifdef DECL_STDIO_0
149#if defined(FILE) || defined(BUFSIZ)
150extern	int	_flsbuf		(int, FILE *);
151extern	int	_filbuf		(FILE *);
152extern	int	fclose		(FILE *);
153extern	int	fflush		(FILE *);
154extern	int	fprintf		(FILE *, const char *, ...);
155extern	int	fscanf		(FILE *, const char *, ...);
156extern	int	fputs		(const char *, FILE *);
157extern	int	fputc		(int, FILE *);
158extern	int	fread		(char *, int, int, FILE *);
159extern	void	perror		(const char *);
160extern	int	printf		(const char *, ...);
161extern	int	setbuf		(FILE *, char *);
162# ifdef HAVE_SETLINEBUF
163extern	int	setlinebuf	(FILE *);
164# endif
165extern	int	setvbuf		(FILE *, char *, int, int);
166extern	int	scanf		(const char *, ...);
167extern	int	sscanf		(const char *, const char *, ...);
168extern	int	vfprintf	(FILE *, const char *, ...);
169extern	int	vsprintf	(char *, const char *, ...);
170#endif
171#endif
172
173#ifdef DECL_STIME_0
174extern	int	stime		(const time_t *);
175#endif
176
177#ifdef DECL_STIME_1
178extern	int	stime		(long *);
179#endif
180
181#ifdef DECL_STRERROR_0
182extern	char *	strerror		(int errnum);
183#endif
184
185#ifdef DECL_STRTOL_0
186extern	long	strtol		(const char *, char **, int);
187#endif
188
189#ifdef DECL_SYSCALL
190extern	int	syscall		(int, ...);
191#endif
192
193#ifdef DECL_SYSLOG_0
194extern	void	closelog	(void);
195#ifndef LOG_DAEMON
196extern	void	openlog		(const char *, int);
197#else
198extern	void	openlog		(const char *, int, int);
199#endif
200extern	int	setlogmask	(int);
201extern	void	syslog		(int, const char *, ...);
202#endif
203
204#ifdef DECL_TIME_0
205extern	time_t	time		(time_t *);
206#endif
207
208#ifdef DECL_TIMEOFDAY_0
209#ifdef SYSV_TIMEOFDAY
210extern	int	gettimeofday	(struct timeval *);
211extern	int	settimeofday	(struct timeval *);
212#else /* not SYSV_TIMEOFDAY */
213struct timezone;
214extern	int	gettimeofday	(struct timeval *, struct timezone *);
215extern	int	settimeofday	(struct timeval *, void *);
216#endif /* not SYSV_TIMEOFDAY */
217#endif
218
219#ifdef DECL_TOLOWER_0
220extern	int	tolower		(int);
221#endif
222
223#ifdef DECL_TOUPPER_0
224extern	int	toupper		(int);
225#endif
226
227/*
228 * Necessary variable declarations.
229 */
230#ifdef DECL_ERRNO
231extern	int	errno;
232#endif
233
234#if defined(DECL_H_ERRNO) && !defined(h_errno)
235extern	int	h_errno;
236#endif
237
238#endif /* l_stdlib_h */
239