INTRO(3) UNIX Programmer's Manual INTRO(3) NAME intro - introduction to library functions SYNOPSIS #include #include DESCRIPTION This section describes functions that may be found in vari- ous libraries, other than those functions that directly invoke UNIX system primitives, which are described in sec- tion 2. This section has the libraries physically grouped together. This is a departure from older versions of the UNIX Programmer's Reference Manual, which did not group functions by library. Functions are divided into various libraries distinguished by the section number at the top of the page: (3) These functions, together with those of section 2 and those marked (3S), constitute library _l_i_b_c, which is automatically loaded by the C compiler _c_c(1) and the Fortran compiler _f_7_7(1). The link editor _l_d(1) searches this library under the `-lc' option. Declarations for some of these functions may be obtained from include files indicated on the appropri- ate pages. (3F) These functions constitute the Fortran 77 runtime sup- port libraries. They are automatically loaded as needed by the Fortran compiler _f_7_7(1). The link edi- tor searches these libraries under the `-lF77', `-lI77', and `-lU77' options. (3J) These functions are part of the job control facili- ties, contained in the library _l_i_b_j_o_b_s. The link edi- tor searches this library under the `-ljobs' option. The job control facilities are outlined in _i_n_t_r_o(3J). (3M) These functions constitute the math library, _l_i_b_m. They are automatically loaded as needed by the Fortran compiler _f_7_7(1). The link editor searches this library under the `-lm' option. Declarations for these functions may be obtained from the include file . (3S) These functions constitute the `standard I/O package', see _i_n_t_r_o(3S). These functions are in the library _l_i_b_c already mentioned. Declarations for these func- tions may be obtained from the include file . (3X) Various specialized libraries have not been given Printed 7/31/83 1 INTRO(3) UNIX Programmer's Manual INTRO(3) distinctive captions. The files in which these libraries are found are named on the appropriate pages. The overlaid version of a library named _x is conventionally named _o_v_x. Thus if the -l_x option to _l_d includes library _x, -l_o_v_x will cause _l_d to search the overlaid version instead. FILES /lib/libc.a C library /usr/lib/libovc.a overlaid C library /usr/lib/libjobs.a jobs library /usr/lib/libovjobs.aoverlaid jobs library /usr/lib/libm.a math library /usr/lib/libovm.a overlaid math library /usr/lib/libF77.a Fortran 77 runtime library /usr/lib/libovF77.a overlaid Fortran 77 runtime library /usr/lib/libI77.a Fortran 77 I/O library /usr/lib/libovI77.a overlaid Fortran 77 I/O library /usr/lib/libU77.a Fortran 77 system call library /usr/lib/libovU77.a overlaid Fortran 77 system call library SEE ALSO cc(1), f77(1), ld(1), nm(1), intro(2), intro(3J), intro(3M), intro(3S), intro(3X) DIAGNOSTICS Functions in the math library (3M) may return conventional values when the function is undefined for the given argu- ments or when the value is not representable. In these cases the external variable _e_r_r_n_o (see _i_n_t_r_o(2)) is set to the value EDOM or ERANGE. The values of EDOM and ERANGE are defined in the include file <_m_a_t_h._h>. ASSEMBLER In assembly language these functions may be accessed by simulating the C calling sequence. For example, _e_c_v_t(3) might be called this way: setd mov $sign,-(sp) mov $decpt,-(sp) mov ndigit,-(sp) movf value,-(sp) jsr pc,_ecvt add $14.,sp LIST OF FUNCTIONS _N_a_m_e _A_p_p_e_a_r_s _o_n _P_a_g_e _D_e_s_c_r_i_p_t_i_o_n 9 abort abort.3 generate a fault abort abort.3f terminate abruptly with memory image Printed 7/31/83 2 9 INTRO(3) UNIX Programmer's Manual INTRO(3) abs abs.3 integer absolute value access access.3f determine accessibility of a file acos sin.3m trigonometric functions alarm alarm.3f execute a subroutine after a specified time arc plot.3x graphics interface asctime ctime.3 convert date and time to ASCII asin sin.3m trigonometric functions assert assert.3x program verification atan sin.3m trigonometric functions atan2 sin.3m trigonometric functions atof atoi.3 convert ASCII to numbers atoi atoi.3 convert ASCII to numbers atol atoi.3 convert ASCII to numbers besj0 bessel.3f bessel functions of two kinds for integer orders besj1 bessel.3f bessel functions of two kinds for integer orders besjn bessel.3f bessel functions of two kinds for integer orders besy0 bessel.3f bessel functions of two kinds for integer orders besy1 bessel.3f bessel functions of two kinds for integer orders besyn bessel.3f bessel functions of two kinds for integer orders cabs hypot.3m Euclidean distance calloc malloc.3 main memory allocator ceil floor.3m absolute value, floor, ceiling functions chdir chdir.3f change default directory circle plot.3x graphics interface clearerr ferror.3s stream status inquiries closepl plot.3x graphics interface cont plot.3x graphics interface cos sin.3m trigonometric functions cosh sinh.3m hyperbolic functions crypt crypt.3 DES encryption ctime ctime.3 convert date and time to ASCII ctime time.3f return system time curses curses.3x screen functions with ``optimal'' cursor motion dbesj0 bessel.3f bessel functions of two kinds for integer orders dbesj1 bessel.3f bessel functions of two kinds for integer orders dbesjn bessel.3f bessel functions of two kinds for integer orders dbesy0 bessel.3f bessel functions of two kinds for integer orders dbesy1 bessel.3f bessel functions of two kinds for integer orders dbesyn bessel.3f bessel functions of two kinds for integer orders dbminit dbm.3x data base subroutines delete dbm.3x data base subroutines dflmax range.3f return extreme values dflmin range.3f return extreme values drand rand.3f return random values dtime etime.3f return elapsed execution time ecvt ecvt.3 output conversion edata end.3 last locations in program encrypt crypt.3 DES encryption end end.3 last locations in program endfsent getfsent.3 get file system descriptor file entry endgrent getgrent.3 get group file entry endpwent getpwent.3 get password file entry Printed 7/31/83 3 INTRO(3) UNIX Programmer's Manual INTRO(3) environ exec.3 execute a file erase plot.3x graphics interface etext end.3 last locations in program etime etime.3f return elapsed execution time exec exec.3 execute a file exece exec.3 execute a file execl exec.3 execute a file execle exec.3 execute a file execlp exec.3 execute a file execv exec.3 execute a file execvp exec.3 execute a file exit exit.3f terminate process with status exp exp.3m exponential, logarithm, power, square root fabs floor.3m absolute value, floor, ceiling functions fclose fclose.3s close or flush a stream fcvt ecvt.3 output conversion fdate fdate.3f return date and time in an ASCII string fdopen fopen.3s attach buffering to a descriptor feof ferror.3s stream status inquiries ferror ferror.3s stream status inquiries fetch dbm.3x data base subroutines fflush fclose.3s close or flush a stream fgetc getc.3f get a character from a logical unit fgetc getc.3s get character or word from stream fgets gets.3s get a string from a stream fileno ferror.3s stream status inquiries firstkey dbm.3x data base subroutines flmax range.3f return extreme values flmin range.3f return extreme values floor floor.3m absolute value, floor, ceiling functions flush flush.3f flush output to a logical unit fork fork.3f create a copy of this process fopen fopen.3s open a file and associate a stream fprintf printf.3s formatted output conversion fputc putc.3f write a character to a fortran logical unit fputc putc.3s put character or word on a stream fputs puts.3s put a string on a stream fread fread.3s buffered binary input/output free malloc.3 main memory allocator freopen fopen.3s reassociate a stream frexp frexp.3 split into mantissa and exponent fscanf scanf.3s formatted input conversion fseek fseek.3f reposition a file on a logical unit fseek fseek.3s reposition a stream fstat stat.3f get file status ftell fseek.3f reposition a file on a logical unit ftell fseek.3s reposition a stream fwrite fread.3s buffered binary input/output gamma gamma.3m log gamma function gcvt ecvt.3 output conversion gerror perror.3f get system error messages getarg getarg.3f command arguments to Fortran Printed 7/31/83 4 INTRO(3) UNIX Programmer's Manual INTRO(3) getc getc.3f get a character from a logical unit getc getc.3s get character or word from stream getchar getc.3s get character or word from stream getenv getenv.3 value for environment name getenv getenv.3f get value of environment variables getfsent getfsent.3 get file system descriptor file entry getfsfile getfsent.3 get file system descriptor file entry getfsspec getfsent.3 get file system descriptor file entry getgid getuid.3f get user or group ID of the caller getgrent getgrent.3 get group file entry getgrgid getgrent.3 get group file entry getgrnam getgrent.3 get group file entry gethostname gethostname.3 get local host's name getlog getlog.3f get user's login name getlogin getlogin.3 get login name getpass getpass.3 read a password getpid getpid.3f get process id getpw getpw.3 get name from uid getpwent getpwent.3 get password file entry getpwnam getpwent.3 get password file entry getpwuid getpwent.3 get password file entry gets gets.3s get a string from a stream getuid getuid.3f get user or group ID of the caller getw getc.3s get character or word from stream getwd getwd.3 get current working directory pathname gmtime ctime.3 convert date and time to ASCII gmtime time.3f return system time hypot hypot.3m Euclidean distance iargc getarg.3f command arguments to Fortran idate idate.3f return date or time in numerical form ierrno perror.3f get system error messages index index.3f tell about character objects index string.3 string operations inmax range.3f return extreme values iran ranm.3f uniform pseudorandom number generator iran ranm.3m uniform pseudorandom number generator irand rand.3f return random values isalnum ctype.3 character classification macros isalpha ctype.3 character classification macros isascii ctype.3 character classification macros isatty ttynam.3f find name of a terminal port isatty ttyname.3 find name of a terminal iscntrl ctype.3 character classification macros isdigit ctype.3 character classification macros islower ctype.3 character classification macros isprint ctype.3 character classification macros ispunct ctype.3 character classification macros isspace ctype.3 character classification macros isupper ctype.3 character classification macros itime idate.3f return date or time in numerical form j0 j0.3m bessel functions j1 j0.3m bessel functions Printed 7/31/83 5 INTRO(3) UNIX Programmer's Manual INTRO(3) jn j0.3m bessel functions kill kill.3f send a signal to a process l3tol l3tol.3 long integer conversions label plot.3x graphics interface ldexp frexp.3 split into mantissa and exponent len index.3f tell about character objects line plot.3x graphics interface linemod plot.3x graphics interface link link.3f make a link to an existing file lnblnk index.3f tell about character objects loadav loadav.3 get load averages loc loc.3f return the address of an object localtime ctime.3 convert date and time to ASCII log exp.3m exponential, logarithm, power, square root log10 exp.3m exponential, logarithm, power, square root longjmp setjmp.3 non-local goto ltime time.3f return system time lto3l l3tol.3 long integer conversions malloc malloc.3 main memory allocator mktemp mktemp.3 make a unique file name modf frexp.3 split into mantissa and exponent monitor monitor.3 prepare execution profile move plot.3x graphics interface nextkey dbm.3x data base subroutines nlist nlist.3 get entries from name list openpl plot.3x graphics interface pclose popen.3s initiate I/O to/from a process perror perror.3 system error messages perror perror.3f get system error messages point plot.3x graphics interface popen popen.3s initiate I/O to/from a process pow exp.3m exponential, logarithm, power, square root printf printf.3s formatted output conversion psignal psignal.3 system signal messages putc putc.3f write a character to a fortran logical unit putc putc.3s put character or word on a stream putchar putc.3s put character or word on a stream puts puts.3s put a string on a stream putw putc.3s put character or word on a stream qsort qsort.3 quicker sort qsort qsort.3f quick sort rand rand.3 random number generator randomize ranm.3m uniform pseudorandom number generator ranm ranm.3f uniform pseudorandom number generator ranm ranm.3m uniform pseudorandom number generator ranres ranm.3f uniform pseudorandom number generator ranres ranm.3m uniform pseudorandom number generator ransav ranm.3f uniform pseudorandom number generator ransav ranm.3m uniform pseudorandom number generator rand rand.3f return random values re_comp regex.3 regular expression handler re_exec regex.3 regular expression handler Printed 7/31/83 6 INTRO(3) UNIX Programmer's Manual INTRO(3) realloc malloc.3 main memory allocator rewind fseek.3s reposition a stream rindex index.3f tell about character objects rindex string.3 string operations rndmze ranm.3f uniform pseudorandom number generator scanf scanf.3s formatted input conversion setbuf setbuf.3s assign buffering to a stream setfsent getfsent.3 get file system descriptor file entry setgrent getgrent.3 get group file entry setjmp setjmp.3 non-local goto setkey crypt.3 DES encryption setpwent getpwent.3 get password file entry sighold sigset.3j manage signals sigignore sigset.3j manage signals signal signal.3f change the action for a signal signal sigset.3j manage signals sigpause sigset.3j manage signals sigrelse sigset.3j manage signals sigset sigset.3j manage signals sin sin.3m trigonometric functions sinh sinh.3m hyperbolic functions sleep sleep.3 suspend execution for interval sleep sleep.3f sleep for awhile space plot.3x graphics interface sprintf printf.3s formatted output conversion sqrt exp.3m exponential, logarithm, power, square root srand rand.3 random number generator sscanf scanf.3s formatted input conversion stat stat.3f get file status store dbm.3x data base subroutines strcat string.3 string operations strcmp string.3 string operations strcpy string.3 string operations strlen string.3 string operations strncat string.3 string operations strncmp string.3 string operations strncpy string.3 string operations swab swab.3 swap bytes sys_errlist perror.3 system error messages sys_nerr perror.3 system error messages sys_siglist psignal.3 system signal messages system system.3s issue a shell command system system.3f execute a unix command tan sin.3m trigonometric functions tanh sinh.3m hyperbolic functions tgetent termcap.3x terminal independent operation routines tgetflag termcap.3x terminal independent operation routines tgetnum termcap.3x terminal independent operation routines tgetstr termcap.3x terminal independent operation routines tgoto termcap.3x terminal independent operation routines timezone ctime.3 convert date and time to ASCII tputs termcap.3x terminal independent operation routines Printed 7/31/83 7 INTRO(3) UNIX Programmer's Manual INTRO(3) traper traper.3f trap arithmetic errors trapov trapov.3f trap and repair floating point overflow ttynam ttynam.3f find name of a terminal port ttyname ttyname.3 find name of a terminal ttyslot ttyname.3 find name of a terminal ungetc ungetc.3s push character back into input stream unlink unlink.3f remove a directory entry varargs varargs.3 variable argument list wait wait.3f wait for a process to terminate y0 j0.3m bessel functions y1 j0.3m bessel functions yn j0.3m bessel functions Printed 7/31/83 8