general functions Overview general functions The library libc includes a number of functions that perform useful, general tasks: abort() End program immediately abs() Return the absolute value of an integer assert() Check assertion at run time atof() Convert ASCII strings to floating point atoi() Convert ASCII strings to integers atol() Convert ASCII strings to long integers calloc() Allocate dynamic memory candaddr()Convert a daddr_t to canonical format candev() Convert a dev_t to canonical format canino() Convert a ino_t to canonical format canint() Convert a int to canonical format canlong() Convert a long to canonical format canshort()Convert a short to canonical format cansize() Convert an fsize_t to canonical format cantime() Convert a time_t to canonical format canvaddr()Convert a vaddr_t to canonical format crypt() Encryption using rotor algorithm ecvt() Convert floating-point numbers to strings endgrent()Close group file endpwent()Close password file exit() Terminate a program fcvt() Convert floating point numbers to ASCII strings free() Return dynamic memory to free memory pool frexp() Separate fraction and exponent gcvt() Convert floating point number to ASCII string getenv() Read environmental variable getgrent()Get group file information getgrgid()Get group file information, by group id getgrnam()Get group file information, by group name getlogin()Get login name getopt() Get a command-line option getpass() Get password with prompting getpw() Search password file getpwent()Get password file information getpwnam()Get password file information, by name getpwuid()Get password file information, by id getwd() Get current working directory name isatty() Check if a device is a terminal l3tol() Convert file system block number to long integer ldexp() Combine fraction and exponent longjmp() Return from a non-local goto ltol3() Convert long integer to file system block number malloc() Allocate dynamic memory memok() Check if the arena is sound mktemp() Generate a temporary file name modf() Separate integral part and fraction mtype() Return symbolic machine type nlist() Symbol table lookup path() Build a path name for a file perror() System call error messages qsort() Sort arrays in memory COHERENT Lexicon Page 1
general functions Overview general functions rand() Generate pseudo-random numbers realloc() Reallocate dynamic memory setgrent()Rewind group file setjmp() Perform non-local goto setpwent()Rewind password file shellsort()Sort arrays in memory sleep() Suspend execution srand() Seed random number generator swab() Swap a pair of bytes system() Pass a command to the shell for execution ttyname() Identify a terminal ttyslot() Return a terminal's line number ***** See Also ***** libraries COHERENT Lexicon Page 2