Home | History | Annotate | Line # | Download | only in include
stdlib.h revision 1.10
      1 /*-
      2  * Copyright (c) 1990 The Regents of the University of California.
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. All advertising materials mentioning features or use of this software
     14  *    must display the following acknowledgement:
     15  *	This product includes software developed by the University of
     16  *	California, Berkeley and its contributors.
     17  * 4. Neither the name of the University nor the names of its contributors
     18  *    may be used to endorse or promote products derived from this software
     19  *    without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  * SUCH DAMAGE.
     32  *
     33  *	from: @(#)stdlib.h	5.13 (Berkeley) 6/4/91
     34  *	$Id: stdlib.h,v 1.10 1993/11/13 01:44:59 jtc Exp $
     35  */
     36 
     37 #ifndef _STDLIB_H_
     38 #define _STDLIB_H_
     39 #include <machine/ansi.h>
     40 
     41 #ifdef	_SIZE_T_
     42 typedef	_SIZE_T_	size_t;
     43 #undef	_SIZE_T_
     44 #endif
     45 
     46 #ifdef	_WCHAR_T_
     47 typedef	_WCHAR_T_	wchar_t;
     48 #undef	_WCHAR_T_
     49 #endif
     50 
     51 typedef struct {
     52 	int quot;		/* quotient */
     53 	int rem;		/* remainder */
     54 } div_t;
     55 typedef struct {
     56 	long quot;		/* quotient */
     57 	long rem;		/* remainder */
     58 } ldiv_t;
     59 
     60 #ifndef	NULL
     61 #define	NULL	0
     62 #endif
     63 
     64 #define	EXIT_FAILURE	1
     65 #define	EXIT_SUCCESS	0
     66 
     67 #define	RAND_MAX	0x7fffffff
     68 
     69 #define	MB_CUR_MAX	1	/* XXX */
     70 
     71 #include <sys/cdefs.h>
     72 
     73 __BEGIN_DECLS
     74 void	 abort __P((void));
     75 int	 abs __P((int));
     76 int	 atexit __P((void (*)(void)));
     77 double	 atof __P((const char *));
     78 int	 atoi __P((const char *));
     79 long	 atol __P((const char *));
     80 void	*bsearch __P((const void *, const void *, size_t,
     81 	    size_t, int (*)(const void *, const void *)));
     82 void	*calloc __P((size_t, size_t));
     83 div_t	 div __P((int, int));
     84 void	 exit __P((int));
     85 void	 free __P((void *));
     86 char	*getenv __P((const char *));
     87 long	 labs __P((long));
     88 ldiv_t	 ldiv __P((long, long));
     89 void	*malloc __P((size_t));
     90 void	 qsort __P((void *, size_t, size_t,
     91 	    int (*)(const void *, const void *)));
     92 int	 rand __P((void));
     93 void	*realloc __P((void *, size_t));
     94 void	 srand __P((unsigned));
     95 double	 strtod __P((const char *, char **));
     96 long	 strtol __P((const char *, char **, int));
     97 unsigned long
     98 	 strtoul __P((const char *, char **, int));
     99 int	 system __P((const char *));
    100 
    101 /* these are currently just stubs */
    102 int	 mblen __P((const char *, size_t));
    103 size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
    104 int	 wctomb __P((char *, wchar_t));
    105 int	 mbtowc __P((wchar_t *, const char *, size_t));
    106 size_t	 wcstombs __P((char *, const wchar_t *, size_t));
    107 
    108 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
    109 #include <sys/types.h>
    110 
    111 #if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2)
    112 void  *alloca __P((int));     /* built-in for gcc */
    113 #else
    114 void  *alloca __P((size_t));
    115 #endif /* __GNUC__ */
    116 
    117 long	 a64l __P((const char *));
    118 char	*l64a __P((long));
    119 
    120 void	 cfree __P((void *));
    121 
    122 int	 getopt __P((int, char * const *, const char *));
    123 extern	 char *optarg;			/* getopt(3) external variables */
    124 extern	 int opterr;
    125 extern	 int optind;
    126 extern	 int optopt;
    127 int	 getsubopt __P((char **, char * const *, char **));
    128 extern	 char *suboptarg;		/* getsubopt(3) external variable */
    129 
    130 int	 heapsort __P((void *, size_t, size_t,
    131 	    int (*)(const void *, const void *)));
    132 int	 radixsort __P((const u_char **, int, const u_char *, u_char));
    133 
    134 char	*initstate __P((unsigned, char *, int));
    135 long	 random __P((void));
    136 char	*setstate __P((char *));
    137 void	 srandom __P((unsigned));
    138 
    139 int	 putenv __P((const char *));
    140 int	 setenv __P((const char *, const char *, int));
    141 void	 unsetenv __P((const char *));
    142 
    143 double	 drand48 __P((void));
    144 double	 erand48 __P((unsigned short[3]));
    145 long	 jrand48 __P((unsigned short[3]));
    146 void	 lcong48 __P((unsigned short[7]));
    147 long	 lrand48 __P((void));
    148 long	 mrand48 __P((void));
    149 long	 nrand48 __P((unsigned short[3]));
    150 unsigned short *seed48 __P((unsigned short[3]));
    151 void	 srand48 __P((long));
    152 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
    153 
    154 __END_DECLS
    155 
    156 #endif /* _STDLIB_H_ */
    157