Main Page | Alphabetical List | Class List | File List | Class Members | File Members

stdlib.h File Reference

#include <nlibc.h>
#include <stddef.h>
#include <float.h>
#include <alloca.h>
#include <stdlib/strtol.h>
#include <stdlib/strtoul.h>
#include <stdlib/strtod.h>
#include <stdlib/rand.h>
#include <stdlib/bsdmalloc.h>

Include dependency graph for stdlib.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

struct  div_t
struct  ldiv_t
struct  lldiv_t

Defines

#define __ldiv_t_defined   1
#define __lldiv_t_defined   1
#define EXIT_FAILURE   1
#define EXIT_SUCCESS   0
#define RAND_MAX   INT_MAX
#define __roundup(x, n)   (((x)+((n)-1))&(~((n)-1)))
#define sizeof_aligned(TY)   __roundup(sizeof(TY),__alignof__(TY))
#define atof(STR)   strtod((STR), (char **)NULL)
#define atoi(nptr)   strtol(nptr, (char **)NULL, 10)
#define atol(nptr)   strtol(nptr, (char **)NULL, 10)
#define atoll(nptr)   strtoll(nptr, (char **)NULL, 10)
#define atoq(nptr)   atoll(nptr);
#define labs(VAL)   abs(VAL)
#define llabs(VAL)   abs(VAL)

Functions

void abort (void)
int system (const char *s)
int abs (int i)
div_t div (int numer, int denom)
ldiv_t ldiv (long int numer, long int denom)
lldiv_t lldiv (long long int numer, long long int denom)


Define Documentation

#define __ldiv_t_defined   1
 

Definition at line 34 of file stdlib.h.

#define __lldiv_t_defined   1
 

Definition at line 43 of file stdlib.h.

#define __roundup x,
 )     (((x)+((n)-1))&(~((n)-1)))
 

Definition at line 61 of file stdlib.h.

#define atof STR   )     strtod((STR), (char **)NULL)
 

NAME
atof - convert a string to a double.

SYNOPSIS
#include <stdlib.h>

double atof(const char *nptr);

DESCRIPTION
The atof() function converts the initial portion of the
string pointed to by nptr to double. The behaviour is the
same as

strtod(nptr, (char **)NULL);

except that atof() does not detect errors.

RETURN VALUE
The converted value.

IMPLEMENTATION for APEnext:
for simplicity, it's the same as strtod().

Definition at line 95 of file stdlib.h.

#define atoi nptr   )     strtol(nptr, (char **)NULL, 10)
 

NAME
atoi, atol, atoll, atoq - convert a string to an integer.

SYNOPSIS
#include <stdlib.h>

int atoi(const char *nptr);
long atol(const char *nptr);
long long atoll(const char *nptr);
long long atoq(const char *nptr);

DESCRIPTION
The atoi() function converts the initial portion of the
string pointed to by nptr to int. The behaviour is the
same as

strtol(nptr, (char **)NULL, 10);

except that atoi() does not detect errors.

The atol() and atoll() functions behave the same as
atoi(), except that they convert the initial portion of
the string to their return type of long or long long.
atoq() is an obsolete name for atoll().

RETURN VALUE
The converted value.

IMPLEMENTATION for APEnext:
for simplicity, all are mapped to the corresponding
strto*() functions.

Definition at line 132 of file stdlib.h.

#define atol nptr   )     strtol(nptr, (char **)NULL, 10)
 

Definition at line 133 of file stdlib.h.

#define atoll nptr   )     strtoll(nptr, (char **)NULL, 10)
 

Definition at line 134 of file stdlib.h.

#define atoq nptr   )     atoll(nptr);
 

Definition at line 135 of file stdlib.h.

#define EXIT_FAILURE   1
 

Definition at line 46 of file stdlib.h.

#define EXIT_SUCCESS   0
 

Definition at line 47 of file stdlib.h.

#define labs VAL   )     abs(VAL)
 

Definition at line 502 of file stdlib.h.

#define llabs VAL   )     abs(VAL)
 

Definition at line 503 of file stdlib.h.

#define RAND_MAX   INT_MAX
 

Definition at line 49 of file stdlib.h.

#define sizeof_aligned TY   )     __roundup(sizeof(TY),__alignof__(TY))
 

calulate the size of a type TY including the alignments.

Definition at line 66 of file stdlib.h.


Function Documentation

void abort void   )  [inline]
 

Definition at line 244 of file stdlib.h.

int abs int  i  )  [inline]
 

NAME
abs, labs, llabs, imaxabs - compute the absolute value of
an integer.

SYNOPSIS
#include <stdlib.h>

int abs(int j);
long int labs(long int j);
long long int llabs(long long int j);

#include <inttypes.h>

intmax_t imaxabs(intmax_t j);

DESCRIPTION
The abs() function computes the absolute value of the
integer argument j. The labs(), llabs() and imaxabs()
functions compute the absolute value of the argument j of
the appropriate integer type for the function.

RETURN VALUE
Returns the absolute value of the integer argument, of the
appropriate integer type for the function.

IMPLEMENTATION for APEnext:
possible (abs,labs,llabs)
--------------------------------------------------------------------------

Definition at line 491 of file stdlib.h.

div_t div int  numer,
int  denom
[inline]
 

NAME
div - computes the quotient and remainder of integer divi­
sion

SYNOPSIS
#include <stdlib.h>

div_t div(int numer, int denom);

DESCRIPTION
The div() function computes the value numer/denom and
returns the quotient and remainder in a structure named
div_t that contains two integer members named quot and
rem.

RETURN VALUE
The div_t structure.

IMPLEMENTATION for APEnext:
done (needs to be optimized), tested
-------------------------------------------------------------------------

Definition at line 530 of file stdlib.h.

References div_t::quot, and div_t::rem.

ldiv_t ldiv long int  numer,
long int  denom
[inline]
 

Definition at line 541 of file stdlib.h.

References ldiv_t::quot, and ldiv_t::rem.

lldiv_t lldiv long long int  numer,
long long int  denom
[inline]
 

Definition at line 552 of file stdlib.h.

References lldiv_t::quot, and lldiv_t::rem.

int system const char *  s  ) 
 

NAME
system - execute a shell command

SYNOPSIS
#include <stdlib.h>

int system (const char * string);

DESCRIPTION
system() executes a command specified in string by calling
/bin/sh -c string, and returns after the command has been
completed. During execution of the command, SIGCHLD will
be blocked, and SIGINT and SIGQUIT will be ignored.

RETURN VALUE
The value returned is -1 on error (e.g. fork failed), and
the return status of the command otherwise. This latter
return status is in the format specified in wait(2).
Thus, the exit code of the command will be WEXITSTA­
TUS(status). In case /bin/sh could not be executed, the
exit status will be that of a command that does exit(127).

If the value of string is NULL, system() returns nonzero
if the shell is available, and zero if not.

system() does not affect the wait status of any other
children.

IMPLEMENTATION for APEnext: implemented (needs to be tested) (system)
----------------------------------------------------------------------------


Generated on Mon Feb 20 15:54:45 2006 for nlibc by doxygen 1.3.5