1 /* @(#)schily.h	1.123 17/08/03 Copyright 1985-2016 J. Schilling */
2 /*
3  *	Definitions for libschily
4  *
5  *	This file should be included past:
6  *
7  *	schily/mconfig.h / config.h
8  *	schily/standard.h
9  *	stdio.h
10  *	stdlib.h	(better use schily/stdlib.h)
11  *	unistd.h	(better use schily/unistd.h) needed f. LARGEFILE support
12  *	schily/string.h
13  *	sys/types.h
14  *
15  *	If you need stdio.h, you must include it before schily/schily.h
16  *
17  *	NOTE: If you need ctype.h and did not include stdio.h you need to
18  *	include ctype.h past schily/schily.h as OpenBSD does not follow POSIX
19  *	and defines EOF in ctype.h
20  *
21  *	Copyright (c) 1985-2016 J. Schilling
22  */
23 /*
24  * The contents of this file are subject to the terms of the
25  * Common Development and Distribution License, Version 1.0 only
26  * (the "License").  You may not use this file except in compliance
27  * with the License.
28  *
29  * See the file CDDL.Schily.txt in this distribution for details.
30  * A copy of the CDDL is also available via the Internet at
31  * http://www.opensource.org/licenses/cddl1.txt
32  *
33  * When distributing Covered Code, include this CDDL HEADER in each
34  * file and include the License file CDDL.Schily.txt from this distribution.
35  */
36 
37 #ifndef _SCHILY_SCHILY_H
38 #define	_SCHILY_SCHILY_H
39 
40 #ifndef _SCHILY_MCONFIG_H
41 #include <schily/mconfig.h>
42 #endif
43 
44 #ifndef _SCHILY_STANDARD_H
45 #include <schily/standard.h>
46 #endif
47 #ifndef _SCHILY_CCOMDEFS_H
48 #include <schily/ccomdefs.h>
49 #endif
50 
51 #ifdef	__cplusplus
52 extern "C" {
53 #endif
54 
55 #if	defined(_INCL_SYS_TYPES_H) || defined(_INCL_TYPES_H) || defined(off_t)
56 #	ifndef	FOUND_OFF_T
57 #	define	FOUND_OFF_T
58 #	endif
59 #endif
60 #if	defined(_INCL_SYS_TYPES_H) || defined(_INCL_TYPES_H) || defined(size_t)
61 #	ifndef	FOUND_SIZE_T
62 #	define	FOUND_SIZE_T
63 #	endif
64 #endif
65 #if	defined(_MSC_VER) && !defined(_SIZE_T_DEFINED)
66 #	undef	FOUND_SIZE_T
67 #endif
68 
69 #ifdef	__never_def__
70 /*
71  * It turns out that we cannot use the folloginw definition because there are
72  * some platforms that do not behave application friendly. These are mainly
73  * BSD-4.4 based systems (which #undef a definition when size_t is available.
74  * We actually removed this code because of a problem with QNX Neutrino.
75  * For this reason, it is important not to include <sys/types.h> directly but
76  * via the Schily SING include files so we know whether it has been included
77  * before we come here.
78  */
79 #if	defined(_SIZE_T)	|| defined(_T_SIZE_)	|| defined(_T_SIZE) || \
80 	defined(__SIZE_T)	|| defined(_SIZE_T_)	|| \
81 	defined(_GCC_SIZE_T)	|| defined(_SIZET_)	|| \
82 	defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t)
83 
84 #ifndef	FOUND_SIZE_T
85 #	define	FOUND_SIZE_T	/* We already included a size_t definition */
86 #endif
87 #endif
88 #endif	/* __never_def__ */
89 
90 #if	defined(HAVE_LARGEFILES)
91 #	define	_fcons		_fcons64
92 #	define	fdup		fdup64
93 #	define	fileluopen	fileluopen64
94 #	define	fileopen	fileopen64
95 #	define	filemopen	filemopen64
96 #	define	filepos		filepos64
97 #	define	filereopen	filereopen64
98 #	define	fileseek	fileseek64
99 #	define	filesize	filesize64
100 #	define	filestat	filestat64
101 #	define	_openfd		_openfd64
102 #endif
103 
104 /*
105  * The official POSIX rule is not to define "new" interfaces that
106  * are in conflict with older interfaces of the same name.
107  * Our interfaces fexec*() have been defined and published in 1982.
108  * The new POSIX interfaces define a different interface and the
109  * new POSIX interfaces even use names that are not compatible with
110  * POSIX rules. The new POSIX interfaces in question should be called
111  * fdexec*() to follow the rules of other similar POSIX functions.
112  * Simiar problems exist with getline()/fgetline().
113  */
114 #if	defined(HAVE_RAW_FEXECL) || defined(HAVE_RAW_FEXECLE) || \
115 	defined(HAVE_RAW_FEXECV) || defined(HAVE_RAW_FEXECVE)
116 #define	RENAME_FEXEC
117 #endif
118 #if	defined(HAVE_RAW_FSPAWNV) || defined(HAVE_RAW_FSPAWNL) || \
119 	defined(HAVE_RAW_FSPAWNV_NOWAIT)
120 #define	RENAME_FSPAWN
121 #endif
122 #if	defined(HAVE_RAW_GETLINE) || defined(HAVE_RAW_FGETLINE)
123 #define	RENAME_GETLINE
124 #endif
125 
126 #ifdef	__needed__
127 #define	RENAME_FEXEC
128 #define	RENAME_FSPAWN
129 #define	RENAME_GETLINE
130 #endif
131 
132 #if	defined(RENAME_FEXEC) || defined(RENAME_FSPAWN)
133 #ifndef	_SCHILY_UNISTD_H
134 #include <schily/unistd.h>	/* Need to incl. before fexec*() protoypes */
135 #endif
136 #endif
137 
138 #if	defined(RENAME_GETLINE)
139 #ifndef _SCHILY_STDIO_H
140 #include <schily/stdio.h>	/* Need to incl. before *getline() protoypes */
141 #endif
142 
143 #endif
144 
145 #ifdef	EOF	/* stdio.h has been included */
146 
147 extern	int	_cvmod __PR((const char *, int *, int *));
148 extern	FILE	*_fcons __PR((FILE *, int, int));
149 extern	FILE	*fdup __PR((FILE *));
150 #if	!defined(fdown) || defined(PROTOTYPES)
151 /*
152  * We cannot declare fdown() with K&R in case that fdown() has been #define'd
153  */
154 extern	int	fdown __PR((FILE *));
155 #endif
156 extern	int	js_fexecl __PR((const char *, FILE *, FILE *, FILE *,
157 							const char *, ...));
158 extern	int	js_fexecle __PR((const char *, FILE *, FILE *, FILE *,
159 							const char *, ...));
160 		/* 6th arg not const, fexecv forces av[ac] = NULL */
161 extern	int	js_fexecv __PR((const char *, FILE *, FILE *, FILE *, int,
162 							char **));
163 extern	int	js_fexecve __PR((const char *, FILE *, FILE *, FILE *,
164 					char * const *, char * const *));
165 extern	int	js_fspawnv __PR((FILE *, FILE *, FILE *, int, char * const *));
166 extern	int	js_fspawnl __PR((FILE *, FILE *, FILE *, const char *, ...));
167 extern	int	js_fspawnv_nowait __PR((FILE *, FILE *, FILE *,
168 					const char *, int, char *const*));
169 extern	int	js_fgetline __PR((FILE *, char *, int));
170 #ifdef	FOUND_SIZE_T
171 extern	ssize_t	fgetaline __PR((FILE *, char **, size_t *));
172 extern	ssize_t	getaline __PR((char **, size_t *));
173 #endif
174 extern	int	fgetstr __PR((FILE *, char *, int));
175 extern	int	file_getraise __PR((FILE *));
176 extern	void	file_raise __PR((FILE *, int));
177 extern	int	fileclose __PR((FILE *));
178 extern	FILE	*fileluopen __PR((int, const char *));
179 extern	FILE	*fileopen __PR((const char *, const char *));
180 #ifdef	_SCHILY_TYPES_H
181 extern	FILE	*filemopen __PR((const char *, const char *, mode_t));
182 #endif
183 #ifdef	FOUND_OFF_T
184 extern	off_t	filepos __PR((FILE *));
185 #endif
186 #ifdef	FOUND_SIZE_T
187 extern	ssize_t	fileread __PR((FILE *, void *, size_t));
188 extern	ssize_t	ffileread __PR((FILE *, void *, size_t));
189 #endif
190 extern	FILE	*filereopen __PR((const char *, const char *, FILE *));
191 #ifdef	FOUND_OFF_T
192 extern	int	fileseek __PR((FILE *, off_t));
193 extern	off_t	filesize __PR((FILE *));
194 #endif
195 #ifdef	S_IFMT
196 extern	int	filestat __PR((FILE *, struct stat *));
197 #endif
198 #ifdef	FOUND_SIZE_T
199 extern	ssize_t	filewrite __PR((FILE *, void *, size_t));
200 extern	ssize_t	ffilewrite __PR((FILE *, void *, size_t));
201 #endif
202 extern	int	flush __PR((void));
203 extern	int	fpipe __PR((FILE **));
204 #ifdef	__never__
205 extern	int	fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3);
206 #endif
207 extern	int	getbroken __PR((FILE *, char *, char, char **, int));
208 extern	int	ofindline __PR((FILE *, char, const char *, int,
209 							char **, int));
210 extern	int	peekc __PR((FILE *));
211 
212 #ifdef	__never_def__
213 /*
214  * We cannot define this or we may get into problems with DOS based systems.
215  */
216 extern	int	spawnv __PR((FILE *, FILE *, FILE *, int, char * const *));
217 extern	int	spawnl __PR((FILE *, FILE *, FILE *, const char *, ...));
218 extern	int	spawnv_nowait __PR((FILE *, FILE *, FILE *,
219 					const char *, int, char *const*));
220 #endif	/* __never_def__ */
221 #endif	/* EOF */
222 
223 /*
224  * Flags for absfpath() and resolvefpath():
225  */
226 #define	RSPF_EXIST		0x01	/* All path components must exist    */
227 #define	RSPF_NOFOLLOW_LAST	0x02	/* Don't follow link in last pathcomp */
228 
229 #ifdef	FOUND_SIZE_T
230 extern	char	*abspath __PR((const char *relp, char *absp, size_t asize));
231 extern	char	*absnpath __PR((const char *relp, char *absp, size_t asize));
232 extern	char	*absfpath __PR((const char *relp, char *absp, size_t asize,
233 				int __flags));
234 #ifndef	HAVE_RESOLVEPATH
235 extern	int	resolvepath __PR((const char *__path,
236 				char *__buf, size_t __bufsiz));
237 #endif
238 extern	int	resolvenpath __PR((const char *__path,
239 				char *__buf, size_t __bufsiz));
240 extern	int	resolvefpath __PR((const char *__path,
241 				char *__buf, size_t __bufsiz, int __flags));
242 #endif
243 
244 #ifdef	_SCHILY_TYPES_H
245 extern	int	mkdirs __PR((char *, mode_t));
246 extern	int	makedirs __PR((char *, mode_t, int __striplast));
247 #endif
248 
249 extern	int	lxchdir	__PR((char *));
250 #ifdef	HAVE_FCHDIR
251 #define	fdsetname(fd, name)	(0)
252 #define	fdclosename(fd)		(0)
253 #else
254 extern	int	fdsetname __PR((int fd, const char *name));
255 extern	int	fdclosename __PR((int fd));
256 #endif
257 extern	int	diropen __PR((const char *));
258 extern	int	dirrdopen __PR((const char *));
259 extern	int	dirclose __PR((int));
260 
261 struct save_wd {
262 	int	fd;
263 	char	*name;
264 };
265 
266 extern int	savewd	__PR((struct save_wd *sp));
267 extern void	closewd	__PR((struct save_wd *sp));
268 extern int	restorewd __PR((struct save_wd *sp));
269 
270 
271 #ifdef	_SCHILY_UTYPES_H
272 typedef struct gnmult {
273 	char	key;
274 	Llong	mult;
275 } gnmult_t;
276 
277 extern	int	getllnum __PR((char *arg, Llong *lvalp));
278 extern	int	getxnum	 __PR((char *arg, long *valp, gnmult_t *mult));
279 extern	int	getllxnum __PR((char *arg, Llong *lvalp, gnmult_t *mult));
280 
281 extern	int	getlltnum  __PR((char *arg, Llong *lvalp));
282 extern	int	getxtnum  __PR((char *arg, time_t *valp, gnmult_t *mult));
283 extern	int	getllxtnum __PR((char *arg, Llong *lvalp, gnmult_t *mult));
284 #endif
285 extern	int	getnum	__PR((char *arg, long *valp));
286 #ifdef	_SCHILY_TIME_H
287 extern	int	gettnum	__PR((char *arg, time_t *valp));
288 #endif
289 
290 #ifdef	_SCHILY_TIME_H
291 
292 extern	int		getnstimeofday	__PR((struct timespec *__tp));
293 extern	int		setnstimeofday	__PR((struct timespec *__tp));
294 
295 #ifdef	_SCHILY_UTYPES_H
296 extern	Llong		mklgmtime	__PR((struct tm *));
297 #endif
298 extern	time_t		mkgmtime	__PR((struct tm *));
299 #endif
300 
301 
302 #ifdef	EOF			/* stdio.h has been included */
303 #ifdef	_SCHILY_TYPES_H
304 /*
305  * getperm() flags:
306  */
307 #define	GP_NOX		0	/* This is not a dir and 'X' is not valid */
308 #define	GP_DOX		1	/* 'X' perm character is valid		  */
309 #define	GP_XERR		2	/* 'X' perm characters are invalid	  */
310 #define	GP_FPERM	4	/* TRUE if we implement find -perm	  */
311 #define	GP_UMASK	8	/* TRUE if we implement umask		  */
312 
313 extern	int	getperm	__PR((FILE *f, char *perm, char *opname, \
314 				mode_t *modep, int smode, int flag));
315 extern	void	permtostr	__PR((mode_t mode, char *));
316 #endif
317 #endif
318 
319 #ifdef	FOUND_SIZE_T
320 extern	ssize_t	_niread __PR((int, void *, size_t));
321 extern	ssize_t	_niwrite __PR((int, void *, size_t));
322 extern	ssize_t	_nixread __PR((int, void *, size_t));
323 extern	ssize_t	_nixwrite __PR((int, void *, size_t));
324 #endif
325 extern	int	_openfd __PR((const char *, int));
326 extern	int	on_comerr __PR((void (*fun)(int, void *), void *arg));
327 /*PRINTFLIKE1*/
328 extern	void	comerr __PR((const char *, ...)) __printflike__(1, 2);
329 /*PRINTFLIKE2*/
330 extern	void	xcomerr	 __PR((int, const char *, ...)) __printflike__(2, 3);
331 /*PRINTFLIKE2*/
332 extern	void	comerrno __PR((int, const char *, ...)) __printflike__(2, 3);
333 /*PRINTFLIKE3*/
334 extern	void	xcomerrno __PR((int, int, const char *, ...)) __printflike__(3, 4);
335 /*PRINTFLIKE1*/
336 extern	int	errmsg __PR((const char *, ...)) __printflike__(1, 2);
337 /*PRINTFLIKE2*/
338 extern	int	errmsgno __PR((int, const char *, ...)) __printflike__(2, 3);
339 #ifdef	FOUND_SIZE_T
340 /*PRINTFLIKE3*/
341 extern	int	serrmsg __PR((char *, size_t, const char *, ...))
342 					__printflike__(3, 4);
343 /*PRINTFLIKE4*/
344 extern	int	serrmsgno __PR((int, char *, size_t, const char *, ...))
345 					__printflike__(4, 5);
346 #endif
347 extern	void	comexit	__PR((int));
348 extern	char	*errmsgstr __PR((int));
349 
350 #ifdef	EOF	/* stdio.h has been included */
351 /*PRINTFLIKE2*/
352 extern	void	fcomerr		__PR((FILE *, const char *, ...))
353 					__printflike__(2, 3);
354 /*PRINTFLIKE3*/
355 extern	void	fxcomerr	__PR((FILE *, int, const char *, ...))
356 					__printflike__(3, 4);
357 /*PRINTFLIKE3*/
358 extern	void	fcomerrno	__PR((FILE *, int, const char *, ...))
359 					__printflike__(3, 4);
360 /*PRINTFLIKE4*/
361 extern	void	fxcomerrno	__PR((FILE *, int, int, const char *, ...))
362 					__printflike__(4, 5);
363 /*PRINTFLIKE2*/
364 extern	int	ferrmsg		__PR((FILE *, const char *, ...))
365 					__printflike__(2, 3);
366 /*PRINTFLIKE3*/
367 extern	int	ferrmsgno	__PR((FILE *, int, const char *, ...))
368 					__printflike__(3, 4);
369 #ifdef	_SCHILY_VARARGS_H
370 #define	COMERR_RETURN	0
371 #define	COMERR_EXIT	1
372 #define	COMERR_EXCODE	2
373 /*PRINTFLIKE5*/
374 extern	int	_comerr		__PR((FILE *, int, int, int,
375 						const char *, va_list));
376 #endif
377 #endif
378 
379 /*PRINTFLIKE1*/
380 extern	int	error __PR((const char *, ...)) __printflike__(1, 2);
381 #ifdef	FOUND_SIZE_T
382 extern	char	*fillbytes __PR((void *, ssize_t, char));
383 extern	char	*zerobytes __PR((void *, ssize_t));
384 extern	char	*findbytes __PR((const void *, ssize_t, char));
385 #endif
386 extern	char	*findinpath __PR((char *__name, int __mode,
387 					BOOL __plain_file, char *__path));
388 extern	int	findline __PR((const char *, char, const char *,
389 							int, char **, int));
390 extern	int	js_getline __PR((char *, int));
391 extern	int	getstr __PR((char *, int));
392 extern	int	breakline __PR((char *, char, char **, int));
393 extern	int	getallargs __PR((int *, char * const**, const char *, ...));
394 extern	int	getargs __PR((int *, char * const**, const char *, ...));
395 extern	int	getfiles __PR((int *, char * const**, const char *));
396 extern	char	*astoi __PR((const char *, int *));
397 extern	char	*astol __PR((const char *, long *));
398 extern	char	*astolb __PR((const char *, long *, int base));
399 #ifdef	_SCHILY_UTYPES_H
400 extern	char	*astoll __PR((const char *, Llong *));
401 extern	char	*astollb __PR((const char *, Llong *, int));
402 extern	char	*astoull __PR((const char *, Ullong *));
403 extern	char	*astoullb __PR((const char *, Ullong *, int));
404 #endif
405 
406 extern	int		patcompile __PR((const unsigned char *, int, int *));
407 extern	unsigned char	*patmatch __PR((const unsigned char *, const int *,
408 					const unsigned char *,
409 					int, int, int, int[]));
410 extern	unsigned char	*patlmatch __PR((const unsigned char *, const int *,
411 					const unsigned char *,
412 					int, int, int, int[]));
413 
414 #ifdef	__never__
415 extern	int	printf __PR((const char *, ...)) __printflike__(1, 2);
416 #endif
417 #ifdef	FOUND_SIZE_T
418 extern	char	*movebytes __PR((const void *, void *, ssize_t));
419 extern	char	*movecbytes __PR((const void *, void *, int, size_t));
420 #endif
421 
422 extern	void	save_args __PR((int, char **));
423 extern	int	saved_ac __PR((void));
424 extern	char	**saved_av __PR((void));
425 extern	char	*saved_av0 __PR((void));
426 extern	char	*searchfileinpath __PR((char *__name, int __mode,
427 					int __file_mode, char *__path));
428 #define	SIP_ANY_FILE	0x00	/* Search for any file type		*/
429 #define	SIP_PLAIN_FILE	0x01	/* Search for plain files - not dirs	*/
430 #define	SIP_NO_PATH	0x10	/* Do not do PATH search		*/
431 #define	SIP_ONLY_PATH	0x20	/* Do only PATH search			*/
432 #define	SIP_NO_STRIPBIN	0x40	/* Do not strip "/bin" from PATH elem.	*/
433 #define	SIP_TYPE_MASK	0x0F	/* Mask file type related bits		*/
434 
435 #ifndef	seterrno
436 extern	int	seterrno __PR((int));
437 #endif
438 extern	void	set_progname __PR((const char *));
439 extern	char	*get_progname __PR((void));
440 extern	char	*get_progpath __PR((void));
441 extern	char	*getexecpath __PR((void));
442 
443 extern	void	setfp __PR((void * const *));
444 extern	int	wait_chld __PR((int));		/* for fspawnv_nowait() */
445 extern	int	geterrno __PR((void));
446 extern	void	raisecond __PR((const char *, long));
447 #ifdef	__never__
448 /*
449  * sprintf() may be declared incorrectly somewhere else
450  * e.g. in old BSD include files
451  */
452 extern	int	sprintf __PR((char *, const char *, ...));
453 #endif
454 extern	char	*strcatl __PR((char *, ...));
455 #ifdef	FOUND_SIZE_T
456 extern	size_t	strlcatl __PR((char *, size_t, ...));
457 #endif
458 extern	int	streql __PR((const char *, const char *));
459 #ifdef	_SCHILY_WCHAR_H
460 extern	wchar_t	*wcscatl __PR((wchar_t *, ...));
461 #ifdef	FOUND_SIZE_T
462 extern	size_t	wcslcatl __PR((wchar_t *, size_t, ...));
463 #endif
464 extern	int	wcseql __PR((const wchar_t *, const wchar_t *));
465 #endif
466 #ifdef	va_arg
467 extern	int	format __PR((void (*)(char, void *), void *, const char *,
468 							va_list));
469 extern	int	fprformat __PR((void *, const char *, va_list));
470 #else
471 extern	int	format __PR((void (*)(char, void *), void *, const char *, void *));
472 extern	int	fprformat __PR((void *, const char *, void *));
473 #endif
474 
475 extern	int	ftoes __PR((char *, double, int, int));
476 extern	int	ftofs __PR((char *, double, int, int));
477 #ifdef	HAVE_LONGDOUBLE
478 extern	int	qftoes __PR((char *, long double, int, int));
479 extern	int	qftofs __PR((char *, long double, int, int));
480 #endif
481 
482 /*PRINTFLIKE1*/
483 extern	int	js_error __PR((const char *, ...)) __printflike__(1, 2);
484 /*PRINTFLIKE2*/
485 extern	int	js_dprintf	__PR((int, const char *, ...))
486 							__printflike__(2, 3);
487 #ifdef	EOF	/* stdio.h has been included */
488 /*PRINTFLIKE2*/
489 extern	int	js_fprintf	__PR((FILE *, const char *, ...))
490 							__printflike__(2, 3);
491 #endif	/* EOF */
492 /*PRINTFLIKE1*/
493 extern	int	js_printf	__PR((const char *, ...)) __printflike__(1, 2);
494 #ifdef	FOUND_SIZE_T
495 /*PRINTFLIKE3*/
496 extern	int	js_snprintf	__PR((char *, size_t, const char *, ...))
497 							__printflike__(3, 4);
498 #endif
499 /*PRINTFLIKE2*/
500 extern	int	js_sprintf	__PR((char *, const char *, ...))
501 							__printflike__(2, 3);
502 
503 #ifdef	FOUND_SIZE_T
504 extern	void	swabbytes	__PR((void *, ssize_t));
505 #endif
506 extern	char	**getmainfp	__PR((void));
507 extern	char	**getavp	__PR((void));
508 extern	char	*getav0		__PR((void));
509 extern	void	**getfp		__PR((void));
510 extern	int	flush_reg_windows __PR((int));
511 #ifdef	FOUND_SIZE_T
512 extern	ssize_t	cmpbytes	__PR((const void *, const void *, ssize_t));
513 extern	int	cmpmbytes	__PR((const void *, const void *, ssize_t));
514 extern	ssize_t	cmpnullbytes	__PR((const void *, ssize_t));
515 #endif
516 
517 #ifdef	nonono
518 #if	defined(HAVE_LARGEFILES)
519 /*
520  * To allow this, we need to figure out how to do autoconfiguration for off64_t
521  */
522 extern	FILE	*_fcons64	__PR((FILE *, int, int));
523 extern	FILE	*fdup64		__PR((FILE *));
524 extern	FILE	*fileluopen64	__PR((int, const char *));
525 extern	FILE	*fileopen64	__PR((const char *, const char *));
526 #ifdef	FOUND_OFF_T
527 extern	off64_t	filepos64	__PR((FILE *));
528 #endif
529 extern	FILE	*filereopen64	__PR((const char *, const char *, FILE *));
530 #ifdef	FOUND_OFF_T
531 extern	int	fileseek64	__PR((FILE *, off64_t));
532 extern	off64_t	filesize64	__PR((FILE *));
533 #endif
534 #ifdef	S_IFMT
535 extern	int	filestat64	__PR((FILE *, struct stat *));
536 #endif
537 extern	int	_openfd64	__PR((const char *, int));
538 #endif
539 #endif
540 
541 #ifndef	NO_SCHILY_PRINT		/* Define to disable *printf() redirects */
542 #ifdef	SCHILY_PRINT
543 #ifdef	__never__
544 #undef	error
545 #define	error		js_error
546 #endif	/* __never__ */
547 #undef	dprintf
548 #define	dprintf		js_dprintf
549 #undef	fprintf
550 #define	fprintf		js_fprintf
551 #undef	printf
552 #define	printf		js_printf
553 #undef	snprintf
554 #define	snprintf	js_snprintf
555 #undef	sprintf
556 #define	sprintf		js_sprintf
557 #else
558 #ifndef	HAVE_SNPRINTF
559 #undef	snprintf
560 #define	snprintf	js_snprintf
561 #endif	/* HAVE_SNPRINTF */
562 #endif	/* SCHILY_PRINT */
563 #endif	/* NO_SCHILY_PRINT */
564 
565 #ifndef	NO_SCHILY_GETLINE	/* Define to disable *getline() redirect */
566 #undef	getline
567 #define	getline		js_getline
568 #undef	fgetline
569 #define	fgetline	js_fgetline
570 #endif
571 
572 #ifndef	NO_SCHILY_FEXEC		/* Define to disable fexec*() redirect */
573 #undef	fexecl
574 #define	fexecl		js_fexecl
575 #undef	fexecle
576 #define	fexecle		js_fexecle
577 #undef	fexecv
578 #define	fexecv		js_fexecv
579 #undef	fexecve
580 #define	fexecve		js_fexecve
581 #endif
582 
583 #ifndef	NO_SCHILY_FSPAWN	/* Define to disable fspawn*() redirect */
584 #undef	fspawnv
585 #define	fspawnv		js_fspawnv
586 #undef	fspawnv_nowait
587 #define	fspawnv_nowait	js_fspawnv_nowait
588 #undef	fspawnl
589 #define	fspawnl		js_fspawnl
590 #endif
591 
592 extern	int	js_mexval	__PR((int exval));
593 #ifdef	FOUND_SIZE_T
594 extern	void	*js_malloc	__PR((size_t size, char *msg));
595 extern	void	*js_realloc	__PR((void *ptr, size_t size, char *msg));
596 #endif
597 extern	char	*js_savestr	__PR((const char *s));
598 
599 #ifdef	_SCHILY_JMPDEFS_H
600 
601 /*
602  * Special values for the "jmp" parameter.
603  *
604  * Control how the siglongjmp() should be handled:
605  */
606 #define	JM_EXIT		((sigjmps_t *)-1) /* Call comexit(errno) instead */
607 #define	JM_RETURN	((sigjmps_t *)0)  /* Return instead		 */
608 
609 extern	int	js_jmexval	__PR((int exval));
610 #ifdef	FOUND_SIZE_T
611 extern	void	*js_jmalloc	__PR((size_t size, char *msg, sigjmps_t *jmp));
612 extern	void	*js_jrealloc	__PR((void *ptr, size_t size, char *msg,
613 							sigjmps_t *jmp));
614 #endif
615 extern	char	*js_jsavestr	__PR((const char *s, sigjmps_t *jmp));
616 
617 extern	int	js_fjmexval	__PR((int exval));
618 #ifdef	EOF	/* stdio.h has been included */
619 #ifdef	FOUND_SIZE_T
620 extern	void	*js_fjmalloc	__PR((FILE *f, size_t size, char *msg,
621 						sigjmps_t *jmp));
622 extern	void	*js_fjrealloc	__PR((FILE *f, void *ptr, size_t size,
623 						char *msg, sigjmps_t *jmp));
624 #endif
625 extern	char	*js_fjsavestr	__PR((FILE *f, const char *s, sigjmps_t *jmp));
626 #endif	/* EOF */
627 #endif	/* _SCHILY_JMPDEFS_H */
628 
629 #define	___mexval	js_mexval
630 #define	___malloc	js_malloc
631 #define	___realloc	js_realloc
632 #define	___savestr	js_savestr
633 #define	__jmexval	js_jmexval
634 #define	__jmalloc	js_jmalloc
635 #define	__jrealloc	js_jrealloc
636 #define	__jsavestr	js_jsavestr
637 #define	__fjmalloc	js_fjmalloc
638 #define	__fjmexval	js_fjmexval
639 #define	__fjrealloc	js_fjrealloc
640 #define	__fjsavestr	js_fjsavestr
641 
642 #ifdef	__cplusplus
643 }
644 #endif
645 
646 #if defined(_JOS) || defined(JOS)
647 #	ifndef	_SCHILY_JOS_IO_H
648 #	include <schily/jos_io.h>
649 #	endif
650 #endif
651 
652 #if !defined(_SCHILY_LIBPORT_H) && !defined(NO_LIBPORT_H)
653 #include <schily/libport.h>
654 #endif
655 #if !defined(_SCHILY_HOSTNAME_H) && defined(USE_HOSTNAME_H)
656 #include <schily/hostname.h>
657 #endif
658 
659 #endif	/* _SCHILY_SCHILY_H */
660