xref: /minix3/include/stdlib.h (revision d2532d3d42d764c9ef9816851cdb17eda7e08d36)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: stdlib.h,v 1.115 2015/02/17 20:33:40 joerg Exp $	*/
29865aeaaSBen Gras 
32fe8fb19SBen Gras /*-
42fe8fb19SBen Gras  * Copyright (c) 1990, 1993
52fe8fb19SBen Gras  *	The Regents of the University of California.  All rights reserved.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
82fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
92fe8fb19SBen Gras  * are met:
102fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
112fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
122fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
132fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
142fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
152fe8fb19SBen Gras  * 3. Neither the name of the University nor the names of its contributors
162fe8fb19SBen Gras  *    may be used to endorse or promote products derived from this software
172fe8fb19SBen Gras  *    without specific prior written permission.
182fe8fb19SBen Gras  *
192fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
202fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
212fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
222fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
232fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
242fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
252fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
262fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
272fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
282fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
292fe8fb19SBen Gras  * SUCH DAMAGE.
302fe8fb19SBen Gras  *
312fe8fb19SBen Gras  *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
322fe8fb19SBen Gras  */
339865aeaaSBen Gras 
342fe8fb19SBen Gras #ifndef _STDLIB_H_
352fe8fb19SBen Gras #define _STDLIB_H_
362fe8fb19SBen Gras 
372fe8fb19SBen Gras #include <sys/cdefs.h>
382fe8fb19SBen Gras #include <sys/featuretest.h>
392fe8fb19SBen Gras 
402fe8fb19SBen Gras #if defined(_NETBSD_SOURCE)
412fe8fb19SBen Gras #include <sys/types.h>		/* for quad_t, etc. */
429865aeaaSBen Gras #endif
439865aeaaSBen Gras 
442fe8fb19SBen Gras #include <machine/ansi.h>
452fe8fb19SBen Gras 
462fe8fb19SBen Gras #ifdef	_BSD_SIZE_T_
472fe8fb19SBen Gras typedef	_BSD_SIZE_T_	size_t;
482fe8fb19SBen Gras #undef	_BSD_SIZE_T_
492fe8fb19SBen Gras #endif
502fe8fb19SBen Gras 
512fe8fb19SBen Gras #if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
522fe8fb19SBen Gras typedef	_BSD_WCHAR_T_	wchar_t;
532fe8fb19SBen Gras #undef	_BSD_WCHAR_T_
542fe8fb19SBen Gras #endif
552fe8fb19SBen Gras 
562fe8fb19SBen Gras typedef struct {
572fe8fb19SBen Gras 	int quot;		/* quotient */
582fe8fb19SBen Gras 	int rem;		/* remainder */
592fe8fb19SBen Gras } div_t;
602fe8fb19SBen Gras 
612fe8fb19SBen Gras typedef struct {
622fe8fb19SBen Gras 	long quot;		/* quotient */
632fe8fb19SBen Gras 	long rem;		/* remainder */
642fe8fb19SBen Gras } ldiv_t;
652fe8fb19SBen Gras 
662fe8fb19SBen Gras #if !defined(_ANSI_SOURCE) && \
672fe8fb19SBen Gras     (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
6884d9c625SLionel Sambuc      (__cplusplus - 0) >= 201103L || defined(_NETBSD_SOURCE))
692fe8fb19SBen Gras typedef struct {
702fe8fb19SBen Gras 	/* LONGLONG */
712fe8fb19SBen Gras 	long long int quot;	/* quotient */
722fe8fb19SBen Gras 	/* LONGLONG */
732fe8fb19SBen Gras 	long long int rem;	/* remainder */
742fe8fb19SBen Gras } lldiv_t;
752fe8fb19SBen Gras #endif
762fe8fb19SBen Gras 
772fe8fb19SBen Gras #if defined(_NETBSD_SOURCE)
782fe8fb19SBen Gras typedef struct {
792fe8fb19SBen Gras 	quad_t quot;		/* quotient */
802fe8fb19SBen Gras 	quad_t rem;		/* remainder */
812fe8fb19SBen Gras } qdiv_t;
822fe8fb19SBen Gras #endif
832fe8fb19SBen Gras 
842fe8fb19SBen Gras 
85dbde088dSArun Thomas #include <sys/null.h>
869865aeaaSBen Gras 
872fe8fb19SBen Gras #define	EXIT_FAILURE	1
882fe8fb19SBen Gras #define	EXIT_SUCCESS	0
899865aeaaSBen Gras 
902fe8fb19SBen Gras #define	RAND_MAX	0x7fffffff
919865aeaaSBen Gras 
922fe8fb19SBen Gras extern size_t __mb_cur_max;
932fe8fb19SBen Gras #define	MB_CUR_MAX	__mb_cur_max
949865aeaaSBen Gras 
952fe8fb19SBen Gras __BEGIN_DECLS
962fe8fb19SBen Gras __dead	 void _Exit(int);
972fe8fb19SBen Gras __dead	 void abort(void);
982fe8fb19SBen Gras __pure	 int abs(int);
992fe8fb19SBen Gras int	 atexit(void (*)(void));
1002fe8fb19SBen Gras double	 atof(const char *);
1012fe8fb19SBen Gras int	 atoi(const char *);
1022fe8fb19SBen Gras long	 atol(const char *);
1032fe8fb19SBen Gras #ifndef __BSEARCH_DECLARED
1042fe8fb19SBen Gras #define __BSEARCH_DECLARED
1052fe8fb19SBen Gras /* also in search.h */
1062fe8fb19SBen Gras void	*bsearch(const void *, const void *, size_t, size_t,
1072fe8fb19SBen Gras     int (*)(const void *, const void *));
1082fe8fb19SBen Gras #endif /* __BSEARCH_DECLARED */
1092fe8fb19SBen Gras void	*calloc(size_t, size_t);
1102fe8fb19SBen Gras div_t	 div(int, int);
1112fe8fb19SBen Gras __dead	 void exit(int);
1122fe8fb19SBen Gras void	 free(void *);
1132fe8fb19SBen Gras __aconst char *getenv(const char *);
1142fe8fb19SBen Gras __pure long
1152fe8fb19SBen Gras 	 labs(long);
1162fe8fb19SBen Gras ldiv_t	 ldiv(long, long);
1172fe8fb19SBen Gras void	*malloc(size_t);
1182fe8fb19SBen Gras void	 qsort(void *, size_t, size_t, int (*)(const void *, const void *));
1192fe8fb19SBen Gras int	 rand(void);
1202fe8fb19SBen Gras void	*realloc(void *, size_t);
1212fe8fb19SBen Gras void	 srand(unsigned);
1222fe8fb19SBen Gras double	 strtod(const char * __restrict, char ** __restrict);
1232fe8fb19SBen Gras long	 strtol(const char * __restrict, char ** __restrict, int);
1242fe8fb19SBen Gras unsigned long
1252fe8fb19SBen Gras 	 strtoul(const char * __restrict, char ** __restrict, int);
126*0a6a1f1dSLionel Sambuc #ifdef _OPENBSD_SOURCE
127*0a6a1f1dSLionel Sambuc long long strtonum(const char *, long long, long long, const char **);
128*0a6a1f1dSLionel Sambuc void	*reallocarray(void *, size_t, size_t);
129*0a6a1f1dSLionel Sambuc #endif
1302fe8fb19SBen Gras int	 system(const char *);
1319865aeaaSBen Gras 
1322fe8fb19SBen Gras /* These are currently just stubs. */
1332fe8fb19SBen Gras int	 mblen(const char *, size_t);
1342fe8fb19SBen Gras size_t	 mbstowcs(wchar_t * __restrict, const char * __restrict, size_t);
1352fe8fb19SBen Gras int	 wctomb(char *, wchar_t);
1362fe8fb19SBen Gras int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
1372fe8fb19SBen Gras size_t	 wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
1386adadadeSErik van der Kouwe 
1392fe8fb19SBen Gras #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
1402fe8fb19SBen Gras     defined(_NETBSD_SOURCE)
1416adadadeSErik van der Kouwe 
14262f7f9e6SPhilip Homburg 
1432fe8fb19SBen Gras /*
1442fe8fb19SBen Gras  * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
14511cbb6faSPhilip Homburg  */
1462fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
1472fe8fb19SBen Gras     defined(_REENTRANT) || defined(_NETBSD_SOURCE)
1482fe8fb19SBen Gras int	 rand_r(unsigned int *);
1492fe8fb19SBen Gras #endif
150652618e4SArun Thomas 
15174437819SLionel Sambuc 
1522fe8fb19SBen Gras /*
1532fe8fb19SBen Gras  * X/Open Portability Guide >= Issue 4
1542fe8fb19SBen Gras  */
1552fe8fb19SBen Gras #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1562fe8fb19SBen Gras double	 drand48(void);
1572fe8fb19SBen Gras double	 erand48(unsigned short[3]);
1582fe8fb19SBen Gras long	 jrand48(unsigned short[3]);
1592fe8fb19SBen Gras void	 lcong48(unsigned short[7]);
1602fe8fb19SBen Gras long	 lrand48(void);
1612fe8fb19SBen Gras long	 mrand48(void);
1622fe8fb19SBen Gras long	 nrand48(unsigned short[3]);
1632fe8fb19SBen Gras unsigned short *
1642fe8fb19SBen Gras 	 seed48(unsigned short[3]);
1652fe8fb19SBen Gras void	 srand48(long);
1669865aeaaSBen Gras 
167f14fb602SLionel Sambuc #ifndef __LIBC12_SOURCE__
168f14fb602SLionel Sambuc int	 putenv(char *) __RENAME(__putenv50);
169f14fb602SLionel Sambuc #endif
1702fe8fb19SBen Gras #endif
1712fe8fb19SBen Gras 
1722fe8fb19SBen Gras 
1732fe8fb19SBen Gras /*
1742fe8fb19SBen Gras  * X/Open Portability Guide >= Issue 4 Version 2
1752fe8fb19SBen Gras  */
1762fe8fb19SBen Gras #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
1772fe8fb19SBen Gras     (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
1782fe8fb19SBen Gras long	 a64l(const char *);
1792fe8fb19SBen Gras char	*l64a(long);
1802fe8fb19SBen Gras 
1812fe8fb19SBen Gras long	 random(void);
1822fe8fb19SBen Gras char	*setstate(char *);
183*0a6a1f1dSLionel Sambuc #ifndef __LIBC12_SOURCE__
184*0a6a1f1dSLionel Sambuc char	*initstate(unsigned int, char *, size_t) __RENAME(__initstate60);
185*0a6a1f1dSLionel Sambuc void	 srandom(unsigned int) __RENAME(__srandom60);
186*0a6a1f1dSLionel Sambuc #endif
1872fe8fb19SBen Gras #ifdef _NETBSD_SOURCE
1882fe8fb19SBen Gras #define	RANDOM_MAX	0x7fffffff	/* (((long)1 << 31) - 1) */
189*0a6a1f1dSLionel Sambuc int	 mkostemp(char *, int);
190*0a6a1f1dSLionel Sambuc int	 mkostemps(char *, int, int);
1912fe8fb19SBen Gras #endif
1922fe8fb19SBen Gras 
1932fe8fb19SBen Gras char	*mkdtemp(char *);
1942fe8fb19SBen Gras int	 mkstemp(char *);
1952fe8fb19SBen Gras char	*mktemp(char *)
1962fe8fb19SBen Gras #ifdef __MKTEMP_OK__
1972fe8fb19SBen Gras 	__RENAME(_mktemp)
1982fe8fb19SBen Gras #endif
1992fe8fb19SBen Gras 	;
2002fe8fb19SBen Gras 
2012fe8fb19SBen Gras int	 setkey(const char *);
2022fe8fb19SBen Gras 
203f14fb602SLionel Sambuc char	*realpath(const char * __restrict, char * __restrict);
2042fe8fb19SBen Gras 
2052fe8fb19SBen Gras int	 ttyslot(void);
2062fe8fb19SBen Gras 
2072fe8fb19SBen Gras void	*valloc(size_t);		/* obsoleted by malloc() */
2082fe8fb19SBen Gras 
2092fe8fb19SBen Gras int	 grantpt(int);
2102fe8fb19SBen Gras int	 unlockpt(int);
2112fe8fb19SBen Gras char	*ptsname(int);
2122fe8fb19SBen Gras #endif
2132fe8fb19SBen Gras 
2142fe8fb19SBen Gras /*
2152fe8fb19SBen Gras  * ISO C99
2162fe8fb19SBen Gras  */
2172fe8fb19SBen Gras #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
21884d9c625SLionel Sambuc     defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
21984d9c625SLionel Sambuc 
2202fe8fb19SBen Gras /* LONGLONG */
2212fe8fb19SBen Gras long long int	atoll(const char *);
2222fe8fb19SBen Gras /* LONGLONG */
2232fe8fb19SBen Gras long long int	llabs(long long int);
2242fe8fb19SBen Gras /* LONGLONG */
2252fe8fb19SBen Gras lldiv_t		lldiv(long long int, long long int);
2262fe8fb19SBen Gras /* LONGLONG */
2272fe8fb19SBen Gras long long int	strtoll(const char * __restrict, char ** __restrict, int);
2282fe8fb19SBen Gras /* LONGLONG */
2292fe8fb19SBen Gras unsigned long long int
2302fe8fb19SBen Gras 		strtoull(const char * __restrict, char ** __restrict, int);
2312fe8fb19SBen Gras float		strtof(const char * __restrict, char ** __restrict);
2322fe8fb19SBen Gras long double	strtold(const char * __restrict, char ** __restrict);
2332fe8fb19SBen Gras #endif
2342fe8fb19SBen Gras 
23584d9c625SLionel Sambuc #if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L || \
23684d9c625SLionel Sambuc     defined(_NETBSD_SOURCE) || (__cplusplus - 0) >= 201103L
23784d9c625SLionel Sambuc int	at_quick_exit(void (*)(void));
23884d9c625SLionel Sambuc __dead void quick_exit(int);
23984d9c625SLionel Sambuc #endif
24084d9c625SLionel Sambuc 
2412fe8fb19SBen Gras /*
2422fe8fb19SBen Gras  * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
2432fe8fb19SBen Gras  */
2442fe8fb19SBen Gras #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
2452fe8fb19SBen Gras     defined(_NETBSD_SOURCE)
2462fe8fb19SBen Gras int	 setenv(const char *, const char *, int);
2472fe8fb19SBen Gras #ifndef __LIBC12_SOURCE__
2482fe8fb19SBen Gras int	 unsetenv(const char *) __RENAME(__unsetenv13);
2492fe8fb19SBen Gras #endif
2502fe8fb19SBen Gras 
2512fe8fb19SBen Gras int	 posix_openpt(int);
2522fe8fb19SBen Gras int	 posix_memalign(void **, size_t, size_t);
2532fe8fb19SBen Gras #endif
2542fe8fb19SBen Gras 
2552fe8fb19SBen Gras /*
2562fe8fb19SBen Gras  * Implementation-defined extensions
2572fe8fb19SBen Gras  */
2582fe8fb19SBen Gras #if defined(_NETBSD_SOURCE)
2592fe8fb19SBen Gras #if defined(alloca) && (alloca == __builtin_alloca) && \
2602fe8fb19SBen Gras 	defined(__GNUC__) && (__GNUC__ < 2)
2612fe8fb19SBen Gras void	*alloca(int);     /* built-in for gcc */
2622fe8fb19SBen Gras #elif defined(__PCC__) && !defined(__GNUC__)
2632fe8fb19SBen Gras #define alloca(size) __builtin_alloca(size)
2642fe8fb19SBen Gras #else
2652fe8fb19SBen Gras void	*alloca(size_t);
2662fe8fb19SBen Gras #endif /* __GNUC__ */
2672fe8fb19SBen Gras 
2682fe8fb19SBen Gras uint32_t arc4random(void);
2692fe8fb19SBen Gras void	 arc4random_stir(void);
270f14fb602SLionel Sambuc void	 arc4random_buf(void *, size_t);
271f14fb602SLionel Sambuc uint32_t arc4random_uniform(uint32_t);
2722fe8fb19SBen Gras void	 arc4random_addrandom(u_char *, int);
2732fe8fb19SBen Gras char	*getbsize(int *, long *);
2742fe8fb19SBen Gras char	*cgetcap(char *, const char *, int);
2752fe8fb19SBen Gras int	 cgetclose(void);
2762fe8fb19SBen Gras int	 cgetent(char **, const char * const *, const char *);
2772fe8fb19SBen Gras int	 cgetfirst(char **, const char * const *);
2782fe8fb19SBen Gras int	 cgetmatch(const char *, const char *);
2792fe8fb19SBen Gras int	 cgetnext(char **, const char * const *);
2802fe8fb19SBen Gras int	 cgetnum(char *, const char *, long *);
2812fe8fb19SBen Gras int	 cgetset(const char *);
2822fe8fb19SBen Gras int	 cgetstr(char *, const char *, char **);
2832fe8fb19SBen Gras int	 cgetustr(char *, const char *, char **);
2842fe8fb19SBen Gras void	 csetexpandtc(int);
2852fe8fb19SBen Gras 
2862fe8fb19SBen Gras int	 daemon(int, int);
287f14fb602SLionel Sambuc int	 devname_r(dev_t, mode_t, char *, size_t);
2882fe8fb19SBen Gras #ifndef __LIBC12_SOURCE__
2892fe8fb19SBen Gras __aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
2902fe8fb19SBen Gras #endif
2912fe8fb19SBen Gras 
2922fe8fb19SBen Gras #define	HN_DECIMAL		0x01
2932fe8fb19SBen Gras #define	HN_NOSPACE		0x02
2942fe8fb19SBen Gras #define	HN_B			0x04
2952fe8fb19SBen Gras #define	HN_DIVISOR_1000		0x08
2962fe8fb19SBen Gras 
2972fe8fb19SBen Gras #define	HN_GETSCALE		0x10
2982fe8fb19SBen Gras #define	HN_AUTOSCALE		0x20
2992fe8fb19SBen Gras 
3002fe8fb19SBen Gras int	 humanize_number(char *, size_t, int64_t, const char *, int, int);
3012fe8fb19SBen Gras int	 dehumanize_number(const char *, int64_t *);
3022fe8fb19SBen Gras 
3032fe8fb19SBen Gras devmajor_t getdevmajor(const char *, mode_t);
3042fe8fb19SBen Gras int	 getloadavg(double [], int);
3052fe8fb19SBen Gras 
3062fe8fb19SBen Gras int	 getenv_r(const char *, char *, size_t);
3072fe8fb19SBen Gras 
3082fe8fb19SBen Gras void	 cfree(void *);
3092fe8fb19SBen Gras 
3102fe8fb19SBen Gras int	 heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
3112fe8fb19SBen Gras int	 mergesort(void *, size_t, size_t,
3122fe8fb19SBen Gras 	    int (*)(const void *, const void *));
313*0a6a1f1dSLionel Sambuc int	 ptsname_r(int, char *, size_t);
3142fe8fb19SBen Gras int	 radixsort(const unsigned char **, int, const unsigned char *,
3152fe8fb19SBen Gras 	    unsigned);
3162fe8fb19SBen Gras int	 sradixsort(const unsigned char **, int, const unsigned char *,
3172fe8fb19SBen Gras 	    unsigned);
3182fe8fb19SBen Gras 
3192fe8fb19SBen Gras void	 mi_vector_hash(const void * __restrict, size_t, uint32_t,
3202fe8fb19SBen Gras 	    uint32_t[3]);
3212fe8fb19SBen Gras 
3222fe8fb19SBen Gras void	 setproctitle(const char *, ...)
3232fe8fb19SBen Gras 	    __printflike(1, 2);
3242fe8fb19SBen Gras const char *getprogname(void) __constfunc;
3252fe8fb19SBen Gras void	setprogname(const char *);
3262fe8fb19SBen Gras 
3272fe8fb19SBen Gras quad_t	 qabs(quad_t);
3282fe8fb19SBen Gras quad_t	 strtoq(const char * __restrict, char ** __restrict, int);
3292fe8fb19SBen Gras u_quad_t strtouq(const char * __restrict, char ** __restrict, int);
3302fe8fb19SBen Gras 
3312fe8fb19SBen Gras 	/* LONGLONG */
3322fe8fb19SBen Gras long long strsuftoll(const char *, const char *, long long, long long);
3332fe8fb19SBen Gras 	/* LONGLONG */
3342fe8fb19SBen Gras long long strsuftollx(const char *, const char *, long long, long long,
3352fe8fb19SBen Gras 	    		char *, size_t);
3362fe8fb19SBen Gras 
3372fe8fb19SBen Gras int	 l64a_r(long, char *, int);
3382fe8fb19SBen Gras 
3392fe8fb19SBen Gras size_t	shquote(const char *, char *, size_t);
3402fe8fb19SBen Gras size_t	shquotev(int, char * const *, char *, size_t);
341*0a6a1f1dSLionel Sambuc 
342*0a6a1f1dSLionel Sambuc int	reallocarr(void *, size_t, size_t);
3432fe8fb19SBen Gras #endif /* _NETBSD_SOURCE */
3442fe8fb19SBen Gras #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
3452fe8fb19SBen Gras 
3462fe8fb19SBen Gras #if defined(_NETBSD_SOURCE)
3472fe8fb19SBen Gras qdiv_t	 qdiv(quad_t, quad_t);
3482fe8fb19SBen Gras #endif
34984d9c625SLionel Sambuc 
35084d9c625SLionel Sambuc #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
35184d9c625SLionel Sambuc #  ifndef __LOCALE_T_DECLARED
35284d9c625SLionel Sambuc typedef struct _locale		*locale_t;
35384d9c625SLionel Sambuc #  define __LOCALE_T_DECLARED
35484d9c625SLionel Sambuc #  endif
35584d9c625SLionel Sambuc double		strtod_l(const char * __restrict, char ** __restrict, locale_t);
35684d9c625SLionel Sambuc float		strtof_l(const char * __restrict, char ** __restrict, locale_t);
35784d9c625SLionel Sambuc long double	strtold_l(const char * __restrict, char ** __restrict,
35884d9c625SLionel Sambuc 			  locale_t);
35984d9c625SLionel Sambuc long	 strtol_l(const char * __restrict, char ** __restrict, int, locale_t);
36084d9c625SLionel Sambuc unsigned long
36184d9c625SLionel Sambuc 	 strtoul_l(const char * __restrict, char ** __restrict, int, locale_t);
36284d9c625SLionel Sambuc /* LONGLONG */
36384d9c625SLionel Sambuc long long int
36484d9c625SLionel Sambuc 	strtoll_l(const char * __restrict, char ** __restrict, int, locale_t);
36584d9c625SLionel Sambuc /* LONGLONG */
36684d9c625SLionel Sambuc unsigned long long int
36784d9c625SLionel Sambuc 	strtoull_l(const char * __restrict, char ** __restrict, int, locale_t);
36884d9c625SLionel Sambuc 
36984d9c625SLionel Sambuc #  if defined(_NETBSD_SOURCE)
37084d9c625SLionel Sambuc quad_t	 strtoq_l(const char * __restrict, char ** __restrict, int, locale_t);
37184d9c625SLionel Sambuc u_quad_t strtouq_l(const char * __restrict, char ** __restrict, int, locale_t);
37284d9c625SLionel Sambuc 
37384d9c625SLionel Sambuc size_t	_mb_cur_max_l(locale_t);
37484d9c625SLionel Sambuc #define	MB_CUR_MAX_L(loc)	_mb_cur_max_l(loc)
37584d9c625SLionel Sambuc int	 mblen_l(const char *, size_t, locale_t);
37684d9c625SLionel Sambuc size_t	 mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t,
37784d9c625SLionel Sambuc 		    locale_t);
37884d9c625SLionel Sambuc int	 wctomb_l(char *, wchar_t, locale_t);
37984d9c625SLionel Sambuc int	 mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
38084d9c625SLionel Sambuc 	          locale_t);
38184d9c625SLionel Sambuc size_t	 wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t,
38284d9c625SLionel Sambuc 		    locale_t);
38384d9c625SLionel Sambuc 
38484d9c625SLionel Sambuc #  endif /* _NETBSD_SOURCE */
38584d9c625SLionel Sambuc #endif /* _POSIX_C_SOURCE >= 200809 || _NETBSD_SOURCE */
38684d9c625SLionel Sambuc 
3872fe8fb19SBen Gras __END_DECLS
3882fe8fb19SBen Gras 
3892fe8fb19SBen Gras #endif /* !_STDLIB_H_ */
390