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