Programming Tools Guide
Chapter 2, C compilation system

General purpose library (libgen)

General purpose library (libgen)

libgen contains general purpose functions. Table 2-7, ``libgen functions'' describes some of the more frequently used functions in libgen. 

Table 2-7 libgen functions

 advance     step      Execute a regular expression
                       on a string.
 basename              Return a pointer to the last
                       element of a pathname.
 bgets                 Read a specified number of
                       characters into a buffer from
                       a stream until a specified
                       character is reached.
 bufsplit              Split the buffer into fields
                       delimited by tabs and new-
                       lines.
 compile               Return a pointer to a compiled
                       regular expression that uses
                       the same syntax as ed.
 copylist              Copy a file into a block of
                       memory, replacing new-lines
                       with null characters.  It
                       returns a pointer to the copy.
 dirname               Return a pointer to the parent
                       directory name of the file
                       pathname.
 eaccess               Determine if the effective
                       user ID has the appropriate
                       permissions on a file.
 gmatch                Check if name matches shell
                       filename pattern.
 isencrypt             Use heuristics to determine if
                       contents of a character buffer
                       are encrypted.
 mkdirp                Create a directory and its
                       parents.
 p2open      p2close   p2open is similar to popen(S) 
                       It establishes a two-way
                       connection between the parent
                       and the child.  p2close closes
                       the pipe.
 pathfind              Search the directories in a
                       given path for a named file
                       with given mode
                       characteristics.  If the file
                       is found, a pointer is
                       returned to a string that
                       corresponds to the pathname of
                       the file.  A null pointer is
                       returned if no file is found.
 regcmp                Compile a regular expression
                       and return a pointer to the
                       compiled form.
 regex                 Compare a compiled regular
                       expression against a subject
                       string.
 rmdirp                Remove the directories in the
                       specified path.
 strccpy     strcadd   strccpy copies the input
                       string to the output string,
                       compressing any C-like escape
                       sequences to the real
                       character.  strcadd is a
                       similar function that returns
                       the address of the null byte
                       at the end of the output
                       string.
 strecpy               Copy the input string to the
                       output string, ing any non-
                       graphic characters with the C
                       escape sequence.  Characters
                       in a third argument are not
                       ed.
 strfind               Return the offset of the first
                       occurrence of the second
                       string in the first string.
                       -1 is returned if the second
                       string does not occur in the
                       first.
 strrspn               Trim trailing characters from
                       a string.  It returns a
                       pointer to the last character
                       in the string not in a list of
                       trailing characters.
 strtrns               Return a pointer to the string
                       that results from replacing
                       any character found in two
                       strings with a character from
                       a third string.  This function
                       is similar to the tr command.