


Synopsys:
     #include <stdlib.h>
     void _Exit(int CODE);
   
Description:
Use '_Exit' to return control from a program to the host operating
environment.  Use the argument CODE to pass an exit status to the
operating environment: two particular values, 'EXIT_SUCCESS' and
'EXIT_FAILURE', are defined in stdlib.h to indicate success or
failure in a portable fashion.

   _Exit differs from exit in that it does not run any
application-defined cleanup functions registered with atexit and it
does not clean up files and streams.  It is identical to '_exit'.

Returns:
_Exit does not return to its caller.

Portability:
_Exit is defined by the C99 standard.

   Supporting OS subroutines required: _exit.

 





Synopsys:
     #include <stdlib.h>
     long a64l(const char *INPUT);
     char *l64a(long INPUT);
   
Description:
Conversion is performed between long and radix-64 characters.  The
'l64a' routine transforms up to 32-bits of input value starting from
least significant bits to the most significant bits.  The input value
is split up into a maximum of 5 groups of 6-bits and possibly one group
of 2 bits (bits 31 and 30).

   Each group of 6 bits forms a value from 0-63 which is translated
into a character as follows:

   0 = .  1 = / 2-11 = 0 to 9 12-37 = A to Z 38-63 = a to z

   When remaining bits are zero or all bits have been translated, a nul
terminator is appended to the string.  An input value of 0 results in
the empty string.

   The 'a64l' performs the reverse translation.  Each character is used
to generate a 6-bit value for up to 30 bits and then a 2-bit value to
complete a 32-bit result.  The nul terminator means that the remaining
digits are 0.  An empty input string or NULL string results in 0L.  An
invalid string results in undefined behavior.  If the size of a long is
> 32 bits, the result is sign-extended.
Returns:
l64a returns a nul-terminated string of 0 to 6 characters.  a64l
returns the 32-bit translated value from the input character string.

Portability:
l64a and a64l are non-ANSI and are defined by the Single Unix
Specification.

   Supporting OS subroutines required: None.

 





Synopsys:
     #include <stdlib.h>
     void abort(void);
   
Description:
Use 'abort' to signal that your program has detected a condition it
cannot deal with.  Normally, abort ends your programs execution.

   Before terminating your program, abort raises the exception
'SIGABRT' (using raise(SIGABRT)).  If you have used signal to
register an exception handler for this condition, that handler has the
opportunity to retain control, thereby avoiding program termination.

   In this implementation, abort does not perform any stream- or
file-related cleanup (the host environment may do so; if not, you can
arrange for your program to do its own cleanup with a SIGABRT
exception handler).

Returns:
abort does not return to its caller.

Portability:
ANSI C requires abort.

   Supporting OS subroutines required: _exit and optionally, write.

 





Synopsys:
     #include <stdlib.h>
     int abs(int I);
   
Description:
'abs' returns the absolute value of I (also called the magnitude of I).
That is, if I is negative, the result is the opposite of I, but if I
is nonnegative the result is I.

   The similar function labs uses and returns long rather than
int values.

Returns:
The result is a nonnegative integer.

Portability:
abs is ANSI.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <assert.h>
     void assert(int EXPRESSION);
   
Description:
Use 'assert' macro to embed debuggging diagnostic statements in your
programs.  The argument EXPRESSION should be an expression which
evaluates to true (nonzero) when your program is working as you
intended.

   When EXPRESSION evaluates to false (zero), assert calls abort,
after first printing a message showing what failed and where:

      Assertion failed: EXPRESSION, file FILENAME, line LINENO

   The macro is defined to permit you to turn off all uses of assert
at compile time by defining NDEBUG as a preprocessor variable.   If
you do this, the assert macro expands to

      (void(0))

Returns:
assert does not return a value.

Portability:
The assert macro is required by ANSI, as is the behavior when
'NDEBUG' is defined.

   Supporting OS subroutines required (only if enabled): close,
fstat, getpid, isatty, kill, lseek, read, sbrk, write.

 





Synopsys:
     #include <stdlib.h>
     int atexit (void (*FUNCTION)(void));
   
Description:
You can use 'atexit' to enroll functions in a list of functions that
will be called when your program terminates normally.  The argument is
a pointer to a user-defined function (which must not require arguments
and must not return a result).

   The functions are kept in a LIFO stack; that is, the last function
enrolled by atexit will be the first to execute when your program
exits.

   There is no built-in limit to the number of functions you can enroll
in this list; however, after every group of 32 functions is enrolled,
atexit will call malloc to get space for the next part of the list.
 The initial list of 32 functions is statically allocated, so you can
always count on at least that many slots available.

Returns:
atexit returns 0 if it succeeds in enrolling your function, -1 if
it fails (possible only if no space was available for malloc to
extend the list of functions).

Portability:
atexit is required by the ANSI standard, which also specifies that
implementations must support enrolling at least 32 functions.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include <stdlib.h>
     double atof(const char *S);
     float atoff(const char *S);
   
Description:
'atof' converts the initial portion of a string to a double.  atoff
converts the initial portion of a string to a float.

   The functions parse the character string S, locating a substring
which can be converted to a floating-point value. The substring must
match the format:
      [+|-]DIGITS[.][DIGITS][(e|E)[+|-]DIGITS]
   The substring converted is the longest initial fragment of S that
has the expected format, beginning with the first non-whitespace
character.  The substring is empty if str is empty, consists entirely
of whitespace, or if the first non-whitespace character is something
other than +, -, ., or a digit.

   atof(S) is implemented as strtod(S, NULL).  atoff(S) is
implemented as strtof(S, NULL).

Returns:
atof returns the converted substring value, if any, as a double; or
0.0,  if no conversion could be performed.  If the correct value is
out of the range of representable values, plus or minus 'HUGE_VAL' is
returned, and ERANGE is stored in errno.  If the correct value
would cause underflow, 0.0 is returned and 'ERANGE' is stored in
errno.

   'atoff' obeys the same rules as atof, except that it returns a
float.

Portability:
atof is ANSI C. atof, atoi, and atol are subsumed by strod
and strol, but are used extensively in existing code. These functions
are less reliable, but may be faster if the argument is verified to be
in a valid range.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include <stdlib.h>
     int atoi(const char *S);
     long atol(const char *S);
     int _atoi_r(struct _reent *PTR, const char *S);
     long _atol_r(struct _reent *PTR, const char *S);
   
Description:
'atoi' converts the initial portion of a string to an int.  'atol'
converts the initial portion of a string to a long.

   atoi(s) is implemented as (int)strtol(s, NULL, 10). atol(s) is
implemented as strtol(s, NULL, 10).

   '_atoi_r' and '_atol_r' are reentrant versions of atoi and atol
respectively, passing the reentrancy struct pointer.

Returns:
The functions return the converted value, if any. If no conversion was
made, 0 is returned.

Portability:
atoi, atol are ANSI.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <stdlib.h>
     long long atoll(const char *STR);
     long long _atoll_r(struct _reent *PTR, const char *STR);
   
Description:
The function 'atoll' converts the initial portion of the string pointed
to by *STR to a type long long.  A call to atoll(str) in this
implementation is equivalent to strtoll(str, (char **)NULL, 10)
including behavior on error.

   The alternate function '_atoll_r' is a reentrant version.  The extra
argument REENT is a pointer to a reentrancy structure.

Returns:
The converted value.

Portability:
atoll is ISO 9899 (C99) and POSIX 1003.1-2001 compatable.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <stdlib.h>
     void *calloc(size_t N, size_t S);
     void *calloc_r(void *REENT, size_t <n>, <size_t> S);
   
Description:
Use 'calloc' to request a block of memory sufficient to hold an array
of N elements, each of which has size S.

   The memory allocated by calloc comes out of the same memory pool
used by malloc, but the memory block is initialized to all zero
bytes.  (To avoid the overhead of initializing the space, use malloc
instead.)

   The alternate function '_calloc_r' is reentrant.  The extra argument
REENT is a pointer to a reentrancy structure.

Returns:
If successful, a pointer to the newly allocated space.

   If unsuccessful, NULL.

Portability:
calloc is ANSI.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include <stdlib.h>
     div_t div(int N, int D);
   
Description:
'div' will divide N/D, returning quotient and remainder as two integers in a
structure 'div_t'.

Returns:
The result is represented with the structure

      typedef struct
      {
       int quot;
       int rem;
      } div_t;

   where the quot field represents the quotient, and rem the
remainder.  For nonzero D, if R = div(N,D); then N equals R.rem +
D*R.quot.

   To divide long rather than int values, use the similar function
ldiv.

Portability:
div is ANSI.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <stdlib.h>

     char *ecvt(double VAL, int CHARS, int *DECPT, int *SGN);
     char *ecvtf(float VAL, int CHARS, int *DECPT, int *SGN);

     char *fcvt(double VAL, int DECIMALS,
         int *DECPT, int *SGN);
     char *fcvtf(float VAL, int DECIMALS,
         int *DECPT, int *SGN);
   
Description:
'ecvt' and 'fcvt' produce (null-terminated) strings of digits
representating the double number VAL.  'ecvtf' and 'fcvtf' produce
the corresponding character representations of float numbers.

   (The stdlib functions ecvtbuf and fcvtbuf are reentrant
versions of ecvt and fcvt.)

   The only difference between ecvt and fcvt is the interpretation
of the second argument (CHARS or DECIMALS).  For ecvt, the second
argument CHARS specifies the total number of characters to write (which
is also the number of significant digits in the formatted string, since
these two functions write only digits).  For fcvt, the second
argument DECIMALS specifies the number of characters to write after the
decimal point; all digits for the integer part of VAL are always
included.

   Since ecvt and fcvt write only digits in the output string, they
record the location of the decimal point in *DECPT, and the sign of
the number in *SGN.  After formatting a number, *DECPT contains the
number of digits to the left of the decimal point.  *SGN contains 0
if the number is positive, and 1 if it is negative.

Returns:
All four functions return a pointer to the new string containing a
character representation of VAL.

Portability:
None of these functions are ANSI C.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include <stdlib.h>

     char *gcvt(double VAL, int PRECISION, char *BUF);
     char *gcvtf(float VAL, int PRECISION, char *BUF);
   
Description:
'gcvt'/'gcvtf' writes a fully formatted number as a null-terminated string in
the buffer *BUF.  gdvtf produces corresponding character
representations of float numbers.

   gcvt uses the same rules as the printf format
%.PRECISIONg--only negative values are signed (with -), and
either exponential or ordinary decimal-fraction format is chosen
depending on the number of significant digits (specified by PRECISION).

Returns:
The result is a pointer to the formatted representation of VAL (the
same as the argument BUF).

Portability:
Neither function is ANSI C.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include <stdio.h>

     char *ecvtbuf(double VAL, int CHARS, int *DECPT,
         int *SGN, char *BUF);

     char *fcvtbuf(double VAL, int DECIMALS, int *DECPT,
         int *SGN, char *BUF);
   
Description:
'ecvtbuf' and 'fcvtbuf' produce (null-terminated) strings of digits
representating the double number VAL.

   The only difference between ecvtbuf and fcvtbuf is the
interpretation of the second argument (CHARS or DECIMALS). For
ecvtbuf, the second argument CHARS specifies the total number of
characters to write (which is also the number of significant digits in
the formatted string, since these two functions write only digits). For
fcvtbuf, the second argument DECIMALS specifies the number of
characters to write after the decimal point; all digits for the integer
part of VAL are always included.

   Since ecvtbuf and fcvtbuf write only digits in the output
string, they record the location of the decimal point in *DECPT, and
the sign of the number in *SGN.  After formatting a number, *DECPT
contains the number of digits to the left of the decimal point.  *SGN
contains 0 if the number is positive, and 1 if it is negative.  For
both functions, you supply a pointer BUF to an area of memory to hold
the converted string.

Returns:
Both functions return a pointer to BUF, the string containing a
character representation of VAL.

Portability:
Neither function is ANSI C.

   Supporting OS subroutines required: close, fstat, isatty,
lseek, read, sbrk, write.

 





Synopsys:
     #include "envlock.h"
     void __env_lock (struct _reent *REENT);
     void __env_unlock (struct _reent *REENT);
   
Description:
The setenv family of routines call these functions when they need to
modify the environ variable.  The version of these routines supplied in
the library use the lock API defined in sys/lock.h.  If multiple
threads of execution can call setenv, or if setenv can be called
reentrantly, then you need to define your own versions of these
functions in order to safely lock the memory pool during a call.  If
you do not, the memory pool may become corrupted.

   A call to setenv may call '__env_lock' recursively; that is, the
sequence of calls may go __env_lock, __env_lock, '__env_unlock',
__env_unlock.  Any implementation of these routines must be careful
to avoid causing a thread to wait for a lock that it already holds.

 





Synopsys:
     #include <stdlib.h>
     void exit(int CODE);
   
Description:
Use 'exit' to return control from a program to the host operating
environment.  Use the argument CODE to pass an exit status to the
operating environment: two particular values, 'EXIT_SUCCESS' and
'EXIT_FAILURE', are defined in stdlib.h to indicate success or
failure in a portable fashion.

   exit does two kinds of cleanup before ending execution of your
program.  First, it calls all application-defined cleanup functions you
have enrolled with atexit.  Second, files and streams are cleaned up:
any pending output is delivered to the host system, each open file or
stream is closed, and files created by tmpfile are deleted.

Returns:
exit does not return to its caller.

Portability:
ANSI C requires exit, and specifies that EXIT_SUCCESS and
EXIT_FAILURE must be defined.

   Supporting OS subroutines required: _exit.

 





Synopsys:
     #include <stdlib.h>
     char *getenv(const char *NAME);
   
Description:
'getenv' searches the list of environment variable names and values
(using the global pointer "char **environ") for a variable whose name
matches the string at NAME.  If a variable name matches, getenv
returns a pointer to the associated value.

Returns:
A pointer to the (string) value of the environment variable, or NULL
if there is no such environment variable.

Portability:
getenv is ANSI, but the rules for properly forming names of
environment variables vary from one system to another.

   getenv requires a global pointer environ.

 





Synopsys:
     #include <stdlib.h>
     long labs(long I);
   
Description:
'labs' returns the absolute value of I (also called the magnitude of
I).  That is, if I is negative, the result is the opposite of I, but if
I is nonnegative the result is I.

   The similar function abs uses and returns int rather than long
values.

Returns:
The result is a nonnegative long integer.

Portability:
labs is ANSI.

   No supporting OS subroutine calls are required.

 





Synopsys:
     #include <stdlib.h>
     ldiv_t ldiv(long N, long D);
   
Description:
'ldiv' will divide N/D, returning quotient and remainder as two long integers in a
structure 'ldiv_t'.

Returns:
The result is represented with the structure

      typedef struct
      {
       long quot;
       long rem;
      } ldiv_t;

   where the quot field represents the quotient, and rem the
remainder.  For nonzero D, if R = ldiv(N,D); then N equals R.rem
+ D*R.quot.

   To divide int rather than long values, use the similar function
div.

Portability:
ldiv is ANSI.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <stdlib.h>
     long long llabs(long long j);
   
Description:
The 'llabs' function computes the absolute value of the long long
integer argument J (also called the magnitude of J).

   The similar function labs uses and returns long rather than
long long values.

Returns:
A nonnegative long long integer.

Portability:
llabs is ISO 9899 (C99) compatable.

   No supporting OS subroutines are required.

 





Synopsys:
     #include <stdlib.h>
     lldiv_t lldiv(long long N, long long D);
   
Description:
'lldiv' will divide N/D, returning quotient and remainder as two long long integers
in a structure 'lldiv_t'.

Returns:
The result is represented with the structure

      typedef struct
      {
       long long quot;
       long long rem;
      } lldiv_t;

   where the quot field represents the quotient, and rem the
remainder.  For nonzero D, if R = ldiv(N,D); then N equals R.rem
+ D*R.quot.

   To divide long rather than long long values, use the similar
function ldiv.

Portability:
lldiv is ISO 9899 (C99) compatable.

   No supporting OS subroutines are required.

 

