.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<stdlib.h>" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <stdlib.h> 
.SH NAME
stdlib.h \- standard library definitions
.SH SYNOPSIS
.LP
\fB#include <stdlib.h>\fP
.SH DESCRIPTION
.LP
Some of the functionality described on this reference page extends
the ISO\ C standard. Applications shall define
the appropriate feature test macro (see the System Interfaces volume
of IEEE\ Std\ 1003.1-2001, Section 2.2, The Compilation Environment)
to enable the visibility of these symbols in this
header. 
.LP
The \fI<stdlib.h>\fP header shall define the following macros:
.TP 7
EXIT_FAILURE
Unsuccessful termination for \fIexit\fP(); evaluates to a non-zero
value.
.TP 7
EXIT_SUCCESS
Successful termination for \fIexit\fP(); evaluates to 0.
.TP 7
NULL
Null pointer.
.TP 7
{RAND_MAX}
Maximum value returned by \fIrand\fP(); at least 32767.
.TP 7
{MB_CUR_MAX}
Integer expression whose value is the maximum number of bytes in a
character specified by the current locale.
.sp
.LP
The following data types shall be defined through \fBtypedef\fP:
.TP 7
\fBdiv_t\fP
Structure type returned by the \fIdiv\fP() function.
.TP 7
\fBldiv_t\fP
Structure type returned by the \fIldiv\fP() function.
.TP 7
\fBlldiv_t\fP
Structure type returned by the \fIlldiv\fP() function.
.TP 7
\fBsize_t\fP
As described in \fI<stddef.h>\fP .
.TP 7
\fBwchar_t\fP
As described in \fI<stddef.h>\fP .
.sp
.LP
In addition, the following symbolic names and macros shall be defined
as in \fI<sys/wait.h>\fP , for use in decoding the return value from
\fIsystem\fP():
.LP
.sp
.sp
WNOHANG
.br
WUNTRACED
.br
WEXITSTATUS
.br
WIFEXITED
.br
WIFSIGNALED
.br
WIFSTOPPED
.br
WSTOPSIG
.br
WTERMSIG
.br
.sp
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf

\fBvoid          _Exit(int);

long          a64l(const char *);

void          abort(void);
int           abs(int);
int           atexit(void (*)(void));
double        atof(const char *);
int           atoi(const char *);
long          atol(const char *);
long long     atoll(const char *);
void         *bsearch(const void *, const void *, size_t, size_t,
                  int (*)(const void *, const void *));
void         *calloc(size_t, size_t);
div_t         div(int, int);

double        drand48(void);
char         *ecvt(double, int, int *restrict, int *restrict); (\fP\fBLEGACY\fP \fB)
double        erand48(unsigned short[3]);

void          exit(int);

char         *fcvt(double, int, int *restrict, int *restrict); (\fP\fBLEGACY\fP \fB)

void          free(void *);

char         *gcvt(double, int, char *); (\fP\fBLEGACY\fP \fB)

char         *getenv(const char *);

int           getsubopt(char **, char *const *, char **);
int           grantpt(int);
char         *initstate(unsigned, char *, size_t);
long          jrand48(unsigned short[3]);
char         *l64a(long);

long          labs(long);

void          lcong48(unsigned short[7]);

ldiv_t        ldiv(long, long);
long long     llabs(long long);
lldiv_t       lldiv(long long, long long);

long          lrand48(void);

void         *malloc(size_t);
int           mblen(const char *, size_t);
size_t        mbstowcs(wchar_t *restrict, const char *restrict, size_t);
int           mbtowc(wchar_t *restrict, const char *restrict, size_t);

char         *mktemp(char *); (\fP\fBLEGACY\fP \fB)
int           mkstemp(char *);
long          mrand48(void);
long          nrand48(unsigned short[3]);


int           posix_memalign(void **, size_t, size_t);


int           posix_openpt(int);
char         *ptsname(int);
int           putenv(char *);

void          qsort(void *, size_t, size_t, int (*)(const void *,
                  const void *));
int           rand(void);

int           rand_r(unsigned *);


long          random(void);

void         *realloc(void *, size_t);

char         *realpath(const char *restrict, char *restrict);
unsigned short seed48(unsigned short[3]);


int           setenv(const char *, const char *, int);


void          setkey(const char *);
char         *setstate(const char *);

void          srand(unsigned);

void          srand48(long);
void          srandom(unsigned);

double        strtod(const char *restrict, char **restrict);
float         strtof(const char *restrict, char **restrict);
long          strtol(const char *restrict, char **restrict, int);
long double   strtold(const char *restrict, char **restrict);
long long     strtoll(const char *restrict, char **restrict, int);
unsigned long strtoul(const char *restrict, char **restrict, int);
unsigned long long
              strtoull(const char *restrict, char **restrict, int);
int           system(const char *);

int           unlockpt(int);


int           unsetenv(const char *);

size_t        wcstombs(char *restrict, const wchar_t *restrict, size_t);
int           wctomb(char *, wchar_t);
\fP
.fi
.RE
.LP
Inclusion of the \fI<stdlib.h>\fP header may also make visible all
symbols from \fI<stddef.h>\fP, \fI<limits.h>\fP, \fI<math.h>\fP, and
\fI<sys/wait.h>\fP. 
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<limits.h>\fP , \fI<math.h>\fP , \fI<stddef.h>\fP , \fI<sys/types.h>\fP
, \fI<sys/wait.h>\fP , the System Interfaces volume of IEEE\ Std\ 1003.1-2001,
\fI_Exit\fP(), \fIa64l\fP(), \fIabort\fP(), \fIabs\fP(), \fIatexit\fP(),
\fIatof\fP(), \fIatoi\fP(), \fIatol\fP(), \fIatoll\fP(), \fIbsearch\fP(),
\fIcalloc\fP(), \fIdiv\fP(), \fIdrand48\fP(), \fIerand48\fP(), \fIexit\fP(),
\fIfree\fP(), \fIgetenv\fP(), \fIgetsubopt\fP(), \fIgrantpt\fP(),
\fIinitstate\fP(), \fIjrand48\fP(), \fIl64a\fP(), \fIlabs\fP(), \fIlcong48\fP(),
\fIldiv\fP(), \fIllabs\fP(), \fIlldiv\fP(), \fIlrand48\fP(), \fImalloc\fP(),
\fImblen\fP(), \fImbstowcs\fP(), \fImbtowc\fP(), \fImkstemp\fP(),
\fImrand48\fP(), \fInrand48\fP(), \fIposix_memalign\fP(), \fIptsname\fP(),
\fIputenv\fP(), \fIqsort\fP(), \fIrand\fP(), \fIrealloc\fP(), \fIrealpath\fP(),
\fIsetstate\fP(), \fIsrand\fP(), \fIsrand48\fP(), \fIsrandom\fP(),
\fIstrtod\fP(), \fIstrtof\fP(), \fIstrtol\fP(), \fIstrtold\fP(), \fIstrtoll\fP(),
\fIstrtoul\fP(), \fIstrtoull\fP(), \fIunlockpt\fP(), \fIwcstombs\fP(),
\fIwctomb\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
