2000-02-18 03:39:52 +08:00
|
|
|
@node Stdlib
|
|
|
|
@chapter Standard Utility Functions (@file{stdlib.h})
|
|
|
|
|
|
|
|
This chapter groups utility functions useful in a variety of programs.
|
|
|
|
The corresponding declarations are in the header file @file{stdlib.h}.
|
|
|
|
|
|
|
|
@menu
|
2024-01-05 13:01:23 +08:00
|
|
|
* Function _Exit:: End program execution without cleaning up
|
|
|
|
* Function a64l:: String to long long
|
|
|
|
* Function abort:: Abnormal termination of a program
|
|
|
|
* Function abs:: Integer absolute value (magnitude)
|
|
|
|
* Function assert:: Macro for Debugging Diagnostics
|
|
|
|
* Function atexit:: Request execution of functions at program exit
|
|
|
|
* Function atof:: String to double or float
|
|
|
|
* Function atoi:: String to integer
|
|
|
|
* Function atoll:: String to long long
|
|
|
|
* Function bsearch:: Binary search
|
|
|
|
* Function calloc:: Allocate space for arrays
|
|
|
|
* Function div:: Divide two integers
|
|
|
|
* Function ecvtbuf:: Double or float to string of digits
|
|
|
|
* Function ecvt:: Double or float to string of digits (malloc result)
|
|
|
|
* Function __env_lock:: Lock environment list for getenv and setenv
|
|
|
|
* Function gcvt:: Format double or float as string
|
|
|
|
* Function exit:: End program execution
|
|
|
|
* Function getenv:: Look up environment variable
|
|
|
|
* Function itoa:: Integer to string
|
|
|
|
* Function labs:: Long integer absolute value (magnitude)
|
|
|
|
* Function ldiv:: Divide two long integers
|
|
|
|
* Function llabs:: Long long integer absolute value (magnitude)
|
|
|
|
* Function lldiv:: Divide two long long integers
|
|
|
|
* Function malloc:: Allocate and manage memory (malloc, realloc, free)
|
|
|
|
* Function mallinfo:: Get information about allocated memory
|
|
|
|
* Function __malloc_lock:: Lock memory pool for malloc and free
|
|
|
|
* Function mbsrtowcs:: Convert a character string to a wide-character string
|
|
|
|
* Function mbstowcs:: Minimal multibyte string to wide string converter
|
|
|
|
* Function mblen:: Minimal multibyte length
|
|
|
|
* Function mbtowc:: Minimal multibyte to wide character converter
|
|
|
|
* Function on_exit:: Request execution of functions at program exit
|
|
|
|
* Function qsort:: Array sort
|
|
|
|
* Function rand:: Pseudo-random numbers
|
|
|
|
* Function random:: Pseudo-random numbers
|
|
|
|
* Function rand48:: Uniformly distributed pseudo-random numbers
|
|
|
|
* Function rpmatch:: Determine whether response is affirmative or negative
|
|
|
|
* Function strtod:: String to double or float
|
|
|
|
* Function strtol:: String to long
|
|
|
|
* Function strtoll:: String to long long
|
|
|
|
* Function strtoul:: String to unsigned long
|
|
|
|
* Function strtoull:: String to unsigned long long
|
|
|
|
* Function wcsrtombs:: Convert a wide-character string to a character string
|
|
|
|
* Function wcstod:: Wide string to double or float
|
|
|
|
* Function wcstol:: Wide string to long
|
|
|
|
* Function wcstoll:: Wide string to long long
|
|
|
|
* Function wcstoul:: Wide string to unsigned long
|
|
|
|
* Function wcstoull:: Wide string to unsigned long long
|
|
|
|
* Function system:: Execute command string
|
|
|
|
* Function utoa:: Unsigned integer to string
|
|
|
|
* Function wcstombs:: Minimal wide string to multibyte string converter
|
|
|
|
* Function wctomb:: Minimal wide character to multibyte converter
|
2000-02-18 03:39:52 +08:00
|
|
|
@end menu
|
|
|
|
|
2004-09-17 05:15:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/_Exit.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/a64l.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/abort.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/abs.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/assert.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/atexit.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/atof.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/atoi.def
|
|
|
|
|
2003-11-28 03:47:19 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/atoll.def
|
|
|
|
|
2010-01-30 07:04:21 +08:00
|
|
|
@page
|
|
|
|
@include search/bsearch.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/calloc.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/div.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/efgcvt.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/ecvtbuf.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/envlock.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/exit.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/getenv.def
|
|
|
|
|
2015-06-23 21:10:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/itoa.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/labs.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/ldiv.def
|
|
|
|
|
2003-11-28 03:47:19 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/llabs.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/lldiv.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/malloc.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/mstats.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/mlock.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/mblen.def
|
|
|
|
|
2009-02-19 17:19:42 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/mbsnrtowcs.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/mbstowcs.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/mbtowc.def
|
|
|
|
|
2004-09-17 05:15:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/on_exit.def
|
|
|
|
|
2010-01-30 07:04:21 +08:00
|
|
|
@page
|
|
|
|
@include search/qsort.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/rand.def
|
|
|
|
|
2016-03-23 06:50:48 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/random.def
|
|
|
|
|
2001-02-14 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* libc/include/stdlib.h: Add declarations of rand48 functions and
their reentrant versions.
* libc/include/sys/reent.h: Move macros from rand48.h. Add
struct _rand48 for shared parameters of rand48 functions.
(struct _reent): Add a variable _r48 of struct _rand48.
(_REENT_INIT): Add _r48 initialization.
* libc/stdlib/Makefile.am (lib_a_SOURCES): Add rand48 functions.
(CHEWOUT_FILES): Add rand48.def.
* libc/stdlib/Makefile.am: Add dependencies for rand48 functions.
* libc/stdlib/Makefile.in: Regenerated.
* libc/stdlib/drand48.c (drand48, _drand48_r): Derived from the
NetBSD C library.
* libc/stdlib/erand48.c (erand48, _erand48_r): Ditto.
* libc/stdlib/jrand48.c (jrand48, _jrand48_r): Ditto.
* libc/stdlib/lcong48.c (lcong48, _lcong48_r): Ditto.
* libc/stdlib/lrand48.c (lrand48, _lrand48_r): Ditto.
* libc/stdlib/mrand48.c (mrand48, _mrand48_r): Ditto.
* libc/stdlib/nrand48.c (nrand48, _nrand48_r): Ditto.
* libc/stdlib/seed48.c (seed48, _seed48_r): Ditto.
* libc/stdlib/srand48.c (srand48, _srand48_r): Ditto.
* libc/stdlib/rand48.c (__dorand48): Ditto.
* libc/stdlib/rand48.h: Ditto, and modify declarations of global
parameters into macros referring them in the reentrant structure.
2001-02-15 10:04:55 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/rand48.def
|
|
|
|
|
2015-11-18 01:53:00 +08:00
|
|
|
@page
|
2015-11-20 05:28:06 +08:00
|
|
|
@include stdlib/rpmatch.def
|
2015-11-18 01:53:00 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/strtod.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/strtol.def
|
|
|
|
|
2004-09-17 05:15:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/strtoll.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/strtoul.def
|
|
|
|
|
2004-09-17 05:15:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/strtoull.def
|
|
|
|
|
2009-02-19 17:19:42 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/wcsnrtombs.def
|
|
|
|
|
2009-02-13 07:10:01 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/wcstod.def
|
|
|
|
|
2007-07-07 04:03:28 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/wcstol.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/wcstoll.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/wcstoul.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/wcstoull.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/system.def
|
|
|
|
|
2015-06-23 21:10:14 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/utoa.def
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
@page
|
|
|
|
@include stdlib/wcstombs.def
|
|
|
|
|
|
|
|
@page
|
|
|
|
@include stdlib/wctomb.def
|
|
|
|
|