 -- Extension: HOST_CHARSET
     This macro indicates the basic character set and encoding used by the host: more precisely, the encoding used for character constants in preprocessor #if statements (the C "execution character set"). It is defined by safe-ctype.h, and will be an integer constant with one of the following values:

     HOST_CHARSET_UNKNOWN
          The host character set is unknown - that is, not one of the next two possibilities.

     HOST_CHARSET_ASCII
          The host character set is ASCII.

     HOST_CHARSET_EBCDIC
          The host character set is some variant of EBCDIC.  (Only one of the nineteen EBCDIC varying characters is tested; exercise caution.)

 -- Replacement: void* alloca (size_t SIZE)

     This function allocates memory which will be automatically reclaimed after the procedure exits.  The libib implementation does not free the memory immediately but will do so eventually during subsequent calls to this function.  Memory is allocated using xmalloc under normal circumstances.

     The header file alloca-conf.h can be used in conjunction with the GNU Autoconf test AC_FUNC_ALLOCA to test for and properly make available this function.  The AC_FUNC_ALLOCA test requires that client code use a block of preprocessor code to be safe (see the Autoconf manual for more); this header incorporates that logic and more, including the possibility of a GCC built-in function.

 -- Extension: int asprintf (char **RESPTR, const char *FORMAT, ...)

     Like sprintf, but instead of passing a pointer to a buffer, you pass a pointer to a pointer.  This function will compute the size of the buffer needed, allocate memory with malloc, and store a pointer to the allocated memory in *RESPTR.  The value returned is the same as sprintf would return.  If memory could not be allocated, minus one is returned and NULL is stored in *RESPTR.

 -- Supplemental: int atexit (void (*F)())

     Causes function F to be called at exit.  Returns 0.

 -- Supplemental: char* basename (const char *NAME)

     Returns a pointer to the last component of pathname NAME. Behavior is undefined if the pathname ends in a directory separator.

 -- Supplemental: int bcmp (char *X, char *Y, int COUNT)

     Compares the first COUNT bytes of two areas of memory.  Returns zero if they are the same, nonzero otherwise.  Returns zero if COUNT is zero.  A nonzero result only indicates a difference, it does not indicate any sorting order (say, by having a positive result mean X sorts before Y).

 -- Supplemental: void bcopy (char *IN, char *OUT, int LENGTH)

     Copies LENGTH bytes from memory region IN to region OUT.  The use of bcopy is deprecated in new programs.

 -- Supplemental: void* bsearch (const void *KEY, const void *BASE, size_t NMEMB, size_t SIZE, int (*COMPAR)(const void *, const void *))

     Performs a search over an array of NMEMB elements pointed to by BASE for a member that matches the object pointed to by KEY. The size of each member is specified by SIZE.  The array contents should be sorted in ascending order according to the COMPAR comparison function.  This routine should take two arguments pointing to the KEY and to an array member, in that order, and should return an integer less than, equal to, or greater than zero if the KEY object is respectively less than, matching, or greater than the array member.

 -- Extension: char** buildargv (char *SP)

     Given a pointer to a string, parse the string extracting fields separated by whitespace and optionally enclosed within either single or double quotes (which are stripped off), and build a vector of pointers to copies of the string for each field.  The input string remains unchanged.  The last element of the vector is followed by a NULL element.

     All of the memory for the pointer array and copies of the string is obtained from malloc.  All of the memory can be returned to the system with the single function call freeargv, which takes the returned result of buildargv, as it's argument.

     Returns a pointer to the argument vector if successful.  Returns NULL if SP is NULL or if there is insufficient memory to complete building the argument vector.

     If the input is a null string (as opposed to a NULL pointer), then buildarg returns an argument vector that has one arg, a null string.

 -- Supplemental: void bzero (char *MEM, int COUNT)

     Zeros COUNT bytes starting at MEM.  Use of this function is deprecated in favor of memset.

 -- Supplemental: void* calloc (size_t NELEM, size_t ELSIZE)

     Uses malloc to allocate storage for NELEM objects of ELSIZE bytes each, then zeros the memory.

 -- Extension: char* choose_temp_base (void)

     Return a prefix for temporary file names or NULL if unable to find one.  The current directory is chosen if all else fails so the program is exited if a temporary directory can't be found (mktemp fails).  The buffer for the result is obtained with xmalloc.

     This function is provided for backwards compatibility only.  Its use is not recommended.

 -- Replacement: char* choose_tmpdir ()

     Returns a pointer to a directory path suitable for creating temporary files in.

 -- Supplemental: long clock (void)

     Returns an approximation of the CPU time used by the process as a clock_t; divide this number by CLOCKS_PER_SEC to get the number of seconds used.

 -- Extension: char* concat (const char *S1, const char *S2, ..., NULL)

     Concatenate zero or more of strings and return the result in freshly xmalloced memory.  Returns NULL if insufficient memory is available.  The argument list is terminated by the first NULL pointer encountered.  Pointers to empty strings are ignored.

 -- Extension: unsigned int crc32 (const unsigned char *BUF, int LEN, unsigned int INIT)

     Compute the 32-bit CRC of BUF which has length LEN.  The starting value is INIT; this may be used to compute the CRC of data split across multiple buffers by passing the return value of each call as the INIT parameter of the next.

     This is intended to match the CRC used by the gdb remote protocol for the qCRC command.  In order to get the same results as gdb for a block of data, you must pass the first CRC parameter as 0xffffffff.

 -- Extension: char** dupargv (char **VECTOR)

     Duplicate an argument vector.  Simply scans through VECTOR, duplicating each argument until the terminating NULL is found. Returns a pointer to the argument vector if successful.  Returns NULL if there is insufficient memory to complete building the argument vector.

 -- Extension: int errno_max (void)

     Returns the maximum errno value for which a corresponding symbolic name or message is available.  Note that in the case where we use the sys_errlist supplied by the system, it is possible for there to be more symbolic names than messages, or vice versa.  In fact, the manual page for perror(3C) explicitly warns that one should check the size of the table (sys_nerr) before indexing it, since new error codes may be added to the system before they are added to the table.  Thus sys_nerr might be smaller than value implied by the largest errno value defined in <errno.h>.

     We return the maximum value that can be used to obtain a meaningful symbolic name or message.

 -- Extension: void expandargv (int *ARGCP, char ***ARGVP)

     The ARGCP and argvp arguments are pointers to the usual argc and argv arguments to main.  This function looks for arguments that begin with the character @.  Any such arguments are interpreted as ``response files''.  The contents of the response file are interpreted as additional command line options.  In particular, the file is separated into whitespace-separated strings; each such string is taken as a command-line option.  The new options are inserted in place of the option naming the response file, and *argcp and *argvp will be updated.  If the value of *argvp is modified by this function, then the new value has been dynamically allocated and can be deallocated by the caller with freeargv.  However, most callers will simply call expandargv near the beginning of main and allow the operating system to free the memory when the program exits.

 -- Extension: int fdmatch (int FD1, int FD2)

     Check to see if two open file descriptors refer to the same file. This is useful, for example, when we have an open file descriptor for an unnamed file, and the name of a file that we believe to correspond to that fd.  This can happen when we are exec'd with an already open file (stdout for example) or from the SVR4 /proc calls that return open file descriptors for mapped address spaces.  All we have to do is open the file by name and check the two file descriptors for a match, which is done by comparing major and minor device numbers and inode numbers.

 -- Extension: FILE * fdopen_unlocked (int FILDES, const char * MODE)

     Opens and returns a FILE pointer via fdopen.  If the operating system supports it, ensure that the stream is setup to avoid any multi-threaded locking.  Otherwise return the FILE pointer unchanged.

 -- Supplemental: int ffs (int VALU)

     Find the first (least significant) bit set in VALU.  Bits are numbered from right to left, starting with bit 1 (corresponding to the value 1).  If VALU is zero, zero is returned.

 -- Extension: int filename_cmp (const char *S1, const char *S2)

     Return zero if the two file names S1 and S2 are equivalent. If not equivalent, the returned value is similar to what strcmp would return.  In other words, it returns a negative value if S1 is less than S2, or a positive value if S2 is greater than S2.

     This function does not normalize file names.  As a result, this function will treat filenames that are spelled differently as different even in the case when the two filenames point to the same underlying file. However, it does handle the fact that on DOS-like file systems, forward and backward slashes are equal.

 -- Replacement: int fnmatch (const char *PATTERN, const char *STRING, int FLAGS)

     Matches STRING against PATTERN, returning zero if it matches, FNM_NOMATCH if not.  PATTERN may contain the wildcards ? to match any one character, * to match any zero or more characters, or a set of alternate characters in square brackets, like [a-gt8], which match one character (a through g, or t, or 8, in this example) if that one character is in the set.  A set may be inverted (i.e., match anything except what's in the set) by giving ^ or ! as the first character in the set.  To include those characters in the set, list them as anything other than the first character of the set.  To include a dash in the set, list it last in the set.  A backslash character makes the following character not special, so for example you could match against a literal asterisk with \*.  To match a literal backslash, use \\.

     flags controls various aspects of the matching process, and is a boolean OR of zero or more of the following values (defined in <fnmatch.h>):

     FNM_PATHNAME
     FNM_FILE_NAME
          STRING is assumed to be a path name.  No wildcard will ever match /.

     FNM_NOESCAPE
          Do not interpret backslashes as quoting the following special character.

     FNM_PERIOD
          A leading period (at the beginning of STRING, or if FNM_PATHNAME after a slash) is not matched by * or ? but must be matched explicitly.

     FNM_LEADING_DIR
          Means that STRING also matches PATTERN if some initial part of STRING matches, and is followed by / and zero or more characters.  For example, foo* would match either foobar or foobar/grill.

     FNM_CASEFOLD
          Ignores case when performing the comparison.

 -- Extension: FILE * fopen_unlocked (const char *PATH, const char * MODE)

     Opens and returns a FILE pointer via fopen.  If the operating system supports it, ensure that the stream is setup to avoid any multi-threaded locking.  Otherwise return the FILE pointer unchanged.

 -- Extension: void freeargv (char **VECTOR)

     Free an argument vector that was built using buildargv.  Simply scans through VECTOR, freeing the memory for each argument until the terminating NULL is found, and then frees VECTOR itself.

 -- Extension: FILE * freopen_unlocked (const char * PATH, const char * MODE, FILE * STREAM)

     Opens and returns a FILE pointer via freopen.  If the operating system supports it, ensure that the stream is setup to avoid any multi-threaded locking.  Otherwise return the FILE pointer unchanged.

 -- Replacement: long get_run_time (void)

     Returns the time used so far, in microseconds.  If possible, this is the time used by this process, else it is the elapsed time since the process started.

 -- Supplemental: char* getcwd (char *PATHNAME, int LEN)

     Copy the absolute pathname for the current working directory into PATHNAME, which is assumed to point to a buffer of at least LEN bytes, and return a pointer to the buffer.  If the current directory's path doesn't fit in LEN characters, the result is NULL and errno is set.  If PATHNAME is a null pointer, getcwd will obtain LEN bytes of space using malloc.

 -- Supplemental: int getpagesize (void)

     Returns the number of bytes in a page of memory.  This is the granularity of many of the system memory management routines.  No guarantee is made as to whether or not it is the same as the basic memory management hardware page size.

 -- Supplemental: char* getpwd (void)

     Returns the current working directory.  This implementation caches the result on the assumption that the process will not call chdir between calls to getpwd.

 -- Supplemental: int gettimeofday (struct timeval *TP, void *TZ)

     Writes the current time to TP.  This implementation requires that TZ be NULL.  Returns 0 on success, -1 on failure.

 -- Extension: void hex_init (void)

     Initializes the array mapping the current character set to corresponding hex values.  This function must be called before any call to hex_p or hex_value.  If you fail to call it, a default ASCII-based table will normally be used on ASCII systems.

 -- Extension: int hex_p (int C)

     Evaluates to non-zero if the given character is a valid hex character, or zero if it is not.  Note that the value you pass will be cast to unsigned char within the macro.

 -- Extension: unsigned int hex_value (int C)

     Returns the numeric equivalent of the given character when interpreted as a hexadecimal digit.  The result is undefined if you pass an invalid hex digit.  Note that the value you pass will be cast to unsigned char within the macro.

     The hex_value macro returns unsigned int, rather than signed int, to make it easier to use in parsing addresses from hex dump files: a signed int would be sign-extended when converted to a wider unsigned type --- like bfd_vma, on some systems.

 -- Supplemental: char* index (char *S, int C)

     Returns a pointer to the first occurrence of the character C in the string S, or NULL if not found.  The use of index is deprecated in new programs in favor of strchr.

 -- Supplemental: void insque (struct qelem *ELEM, struct qelem *PRED)
 -- Supplemental: void remque (struct qelem *ELEM)

     Routines to manipulate queues built from doubly linked lists.  The insque routine inserts ELEM in the queue immediately after PRED.  The remque routine removes ELEM from its containing queue.  These routines expect to be passed pointers to structures which have as their first members a forward pointer and a back pointer, like this prototype (although no prototype is provided):

          struct qelem {
            struct qelem *q_forw;
            struct qelem *q_back;
            char q_data[];
          };

 -- Extension: ISALPHA (C)
 -- Extension: ISALNUM (C)
 -- Extension: ISBLANK (C)
 -- Extension: ISCNTRL (C)
 -- Extension: ISDIGIT (C)
 -- Extension: ISGRAPH (C)
 -- Extension: ISLOWER (C)
 -- Extension: ISPRINT (C)
 -- Extension: ISPUNCT (C)
 -- Extension: ISSPACE (C)
 -- Extension: ISUPPER (C)
 -- Extension: ISXDIGIT (C)

     These twelve macros are defined by safe-ctype.h.  Each has the same meaning as the corresponding macro (with name in lowercase) defined by the standard header ctype.h.  For example, ISALPHA returns true for alphabetic characters and false for others.  However, there are two differences between these macros and those provided by ctype.h:

       * These macros are guaranteed to have well-defined behavior for all values representable by signed char and unsigned char, and for EOF.

       * These macros ignore the current locale; they are true for these fixed sets of characters:

          ALPHA    A-Za-z
          ALNUM    A-Za-z0-9
          BLANK    space tab
          CNTRL    !PRINT
          DIGIT    0-9
          GRAPH    ALNUM || PUNCT
          LOWER    a-z
          PRINT    GRAPH || space
          PUNCT    `~!@#$%^&*()_-=+[{]}\|;:'",<.>/?
          SPACE    space tab \n \r \f \v
          UPPER    A-Z
          XDIGIT   0-9A-Fa-f

          Note that, if the host character set is ASCII or a superset thereof, all these macros will return false for all values of char outside the range of 7-bit ASCII.  In particular, both ISPRINT and ISCNTRL return false for characters with numeric values from 128 to 255.

 -- Extension: ISIDNUM (C)
 -- Extension: ISIDST (C)
 -- Extension: IS_VSPACE (C)
 -- Extension: IS_NVSPACE (C)
 -- Extension: IS_SPACE_OR_NUL (C)
 -- Extension: IS_ISOBASIC (C)
     These six macros are defined by safe-ctype.h and provide additional character classes which are useful when doing lexical analysis of C or similar languages.  They are true for the following sets of characters:

     IDNUM          A-Za-z0-9_
     IDST           A-Za-z_
     VSPACE         \r \n
     NVSPACE        space tab \f \v \0
     SPACE_OR_NUL   VSPACE || NVSPACE
     ISOBASIC       VSPACE || NVSPACE || PRINT

 -- Replacement: const char* lbasename (const char *NAME)

     Given a pointer to a string containing a typical pathname (/usr/src/cmd/ls/ls.c for example), returns a pointer to the last component of the pathname (ls.c in this case).  The returned pointer is guaranteed to lie within the original string.  This latter fact is not true of many vendor C libraries, which return special strings or modify the passed strings for particular input.

     In particular, the empty string returns the same empty string, and a path ending in / returns the empty string after it.

 -- Replacement: const char* lrealpath (const char *NAME)

     Given a pointer to a string containing a pathname, returns a canonical version of the filename.  Symlinks will be resolved, and ``.'' and ``..'' components will be simplified.  The returned value will be allocated using malloc, or NULL will be returned on a memory allocation error.

 -- Extension: const char* make_relative_prefix (const char *PROGNAME, const char *BIN_PREFIX, const char *PREFIX)

     Given three paths PROGNAME, BIN_PREFIX, PREFIX, return the path that is in the same position relative to PROGNAME's directory as PREFIX is relative to BIN_PREFIX.  That is, a string starting with the directory portion of PROGNAME, followed by a relative pathname of the difference between BIN_PREFIX and PREFIX.

     If PROGNAME does not contain any directory separators, make_relative_prefix will search PATH to find a program named PROGNAME.  Also, if PROGNAME is a symbolic link, the symbolic link will be resolved.

     For example, if BIN_PREFIX is /alpha/beta/gamma/gcc/delta, PREFIX is /alpha/beta/gamma/omega/, and PROGNAME is /red/green/blue/gcc, then this function will return /red/green/blue/../../omega/.

     The return value is normally allocated via malloc.  If no relative prefix can be found, return NULL.

 -- Replacement: char* make_temp_file (const char *SUFFIX)

     Return a temporary file name (as a string) or NULL if unable to create one.  SUFFIX is a suffix to append to the file name.  The string is malloced, and the temporary file has been created.

 -- Supplemental: void* memchr (const void *S, int C, size_t N)

     This function searches memory starting at *S for the character C.  The search only ends with the first occurrence of C, or after LENGTH characters; in particular, a null character does not terminate the search.  If the character C is found within LENGTH characters of *S, a pointer to the character is returned.  If C is not found, then NULL is returned.

 -- Supplemental: int memcmp (const void *X, const void *Y, size_t COUNT)

     Compares the first COUNT bytes of two areas of memory.  Returns zero if they are the same, a value less than zero if X is lexically less than Y, or a value greater than zero if X is lexically greater than Y.  Note that lexical order is determined as if comparing unsigned char arrays.

 -- Supplemental: void* memcpy (void *OUT, const void *IN, size_t LENGTH)

     Copies LENGTH bytes from memory region IN to region OUT.  Returns a pointer to OUT.

 -- Supplemental: void* memmem (const void *HAYSTACK, size_t HAYSTACK_LEN const void *NEEDLE, size_t NEEDLE_LEN)

     Returns a pointer to the first occurrence of NEEDLE (length NEEDLE_LEN) in HAYSTACK (length HAYSTACK_LEN). Returns NULL if not found.

 -- Supplemental: void* memmove (void *FROM, const void *TO, size_t COUNT)

     Copies COUNT bytes from memory area FROM to memory area TO, returning a pointer to TO.

 -- Supplemental: void* mempcpy (void *OUT, const void *IN, size_t LENGTH)

     Copies LENGTH bytes from memory region IN to region OUT.  Returns a pointer to OUT + LENGTH.

 -- Supplemental: void* memset (void *S, int C, size_t COUNT)

     Sets the first COUNT bytes of S to the constant byte C, returning a pointer to S.

 -- Replacement: int mkstemps (char *PATTERN, int SUFFIX_LEN)

     Generate a unique temporary file name from PATTERN. PATTERN has the form:

             PATH/ccXXXXXXSUFFIX

     SUFFIX_LEN tells us how long SUFFIX is (it can be zero length).  The last six characters of PATTERN before SUFFIX must be XXXXXX; they are replaced with a string that makes the filename unique.  Returns a file descriptor open on the file for reading and writing.

 -- Extension: void pex_free (struct pex_obj OBJ)

     Clean up and free all data associated with OBJ.  If you have not yet called pex_get_times or pex_get_status, this will try to kill the subprocesses.

 -- Extension: int pex_get_status (struct pex_obj *OBJ, int COUNT, int *VECTOR)

     Returns the exit status of all programs run using OBJ. COUNT is the number of results expected.  The results will be placed into VECTOR.  The results are in the order of the calls to pex_run.  Returns 0 on error, 1 on success.

 -- Extension: int pex_get_times (struct pex_obj *OBJ, int COUNT, struct pex_time *VECTOR)

     Returns the process execution times of all programs run using OBJ.  COUNT is the number of results expected.  The results will be placed into VECTOR.  The results are in the order of the calls to pex_run.  Returns 0 on error, 1 on success.

     struct pex_time has the following fields of the type unsigned long: user_seconds, user_microseconds, system_seconds, system_microseconds.  On systems which do not support reporting process times, all the fields will be set to 0.

 -- Extension: struct pex_obj * pex_init (int FLAGS, const char *PNAME, const char *TEMPBASE)

     Prepare to execute one or more programs, with standard output of each program fed to standard input of the next.  This is a system independent interface to execute a pipeline.

     FLAGS is a bitwise combination of the following:

     PEX_RECORD_TIMES
          Record subprocess times if possible.

     PEX_USE_PIPES
          Use pipes for communication between processes, if possible.

     PEX_SAVE_TEMPS
          Don't delete temporary files used for communication between processes.

     PNAME is the name of program to be executed, used in error messages.  TEMPBASE is a base name to use for any required temporary files; it may be NULL to use a randomly chosen name.

 -- Extension: FILE * pex_input_file (struct pex_obj *OBJ, int FLAGS, const char *IN_NAME)

     Return a stream for a temporary file to pass to the first program in the pipeline as input.

     The name of the input file is chosen according to the same rules pex_run uses to choose output file names, based on IN_NAME, OBJ and the PEX_SUFFIX bit in FLAGS.

     Don't call fclose on the returned stream; the first call to pex_run closes it automatically.

     If FLAGS includes PEX_BINARY_OUTPUT, open the stream in binary mode; otherwise, open it in the default mode.  Including PEX_BINARY_OUTPUT in FLAGS has no effect on Unix.

 -- Extension: FILE * pex_input_pipe (struct pex_obj *OBJ, int BINARY)

     Return a stream FP for a pipe connected to the standard input of the first program in the pipeline; FP is opened for writing. You must have passed PEX_USE_PIPES to the pex_init call that returned OBJ.

     You must close FP using fclose yourself when you have finished writing data to the pipeline.

     The file descriptor underlying FP is marked not to be inherited by child processes.

     On systems that do not support pipes, this function returns NULL, and sets errno to EINVAL.  If you would like to write code that is portable to all systems the pex functions support, consider using pex_input_file instead.

     There are two opportunities for deadlock using pex_input_pipe:

       * Most systems' pipes can buffer only a fixed amount of data; a process that writes to a full pipe blocks.  Thus, if you write to fp before starting the first process, you run the risk of blocking when there is no child process yet to read the data and allow you to continue.  pex_input_pipe makes no promises about the size of the pipe's buffer, so if you need to write any data at all before starting the first process in the pipeline, consider using pex_input_file instead.

       * Using pex_input_pipe and pex_read_output together may also cause deadlock.  If the output pipe fills up, so that each program in the pipeline is waiting for the next to read more data, and you fill the input pipe by writing more data to FP, then there is no way to make progress: the only process that could read data from the output pipe is you, but you are blocked on the input pipe.

 -- Extension: const char * pex_one (int FLAGS, const char *EXECUTABLE, char * const *ARGV, const char *PNAME, const char *OUTNAME, const char *ERRNAME, int *STATUS, int *ERR)

     An interface to permit the easy execution of a single program.  The return value and most of the parameters are as for a call to pex_run.  FLAGS is restricted to a combination of PEX_SEARCH, PEX_STDERR_TO_STDOUT, and PEX_BINARY_OUTPUT.  OUTNAME is interpreted as if PEX_LAST were set.  On a successful return, *STATUS will be set to the exit status of the program.

 -- Extension: FILE * pex_read_err (struct pex_obj *OBJ, int BINARY)

     Returns a FILE pointer which may be used to read the standard error of the last program in the pipeline.  When this is used, PEX_LAST should not be used in a call to pex_run.  After this is called, pex_run may no longer be called with the same OBJ.  BINARY should be non-zero if the file should be opened in binary mode.  Don't call fclose on the returned file; it will be closed by pex_free.

 -- Extension: FILE * pex_read_output (struct pex_obj *OBJ, int BINARY)

     Returns a FILE pointer which may be used to read the standard output of the last program in the pipeline.  When this is used, PEX_LAST should not be used in a call to pex_run.  After this is called, pex_run may no longer be called with the same OBJ.  BINARY should be non-zero if the file should be opened in binary mode.  Don't call fclose on the returned file; it will be closed by pex_free.

 -- Extension: const char * pex_run (struct pex_obj *OBJ, int FLAGS, const char *EXECUTABLE, char * const *ARGV, const char *OUTNAME, const char *ERRNAME, int *ERR)

     Execute one program in a pipeline.  On success this returns NULL.  On failure it returns an error message, a statically allocated string.

     OBJ is returned by a previous call to pex_init.

     FLAGS is a bitwise combination of the following:

     PEX_LAST
          This must be set on the last program in the pipeline.  In particular, it should be set when executing a single program.  The standard output of the program will be sent to OUTNAME, or, if OUTNAME is NULL, to the standard output of the calling program.  Do not set this bit if you want to call pex_read_output (described below).  After a call to pex_run with this bit set, PEX_RUN may no longer be called with the same OBJ.

     PEX_SEARCH
          Search for the program using the user's executable search path.

     PEX_SUFFIX
          OUTNAME is a suffix.  See the description of OUTNAME, below.

     PEX_STDERR_TO_STDOUT
          Send the program's standard error to standard output, if possible.

     PEX_BINARY_INPUT
     PEX_BINARY_OUTPUT
     PEX_BINARY_ERROR
          The standard input (output or error) of the program should be read (written) in binary mode rather than text mode.  These flags are ignored on systems which do not distinguish binary mode and text mode, such as Unix.  For proper behavior these flags should match appropriately---a call to pex_run using PEX_BINARY_OUTPUT should be followed by a call using PEX_BINARY_INPUT.

     PEX_STDERR_TO_PIPE
          Send the program's standard error to a pipe, if possible.  This flag cannot be specified together with PEX_STDERR_TO_STDOUT.  This flag can be specified only on the last program in pipeline.

     EXECUTABLE is the program to execute.  ARGV is the set of arguments to pass to the program; normally ARGV[0] will be a copy of EXECUTABLE.

     OUTNAME is used to set the name of the file to use for standard output.  There are two cases in which no output file will be used:

      1. if PEX_LAST is not set in FLAGS, and PEX_USE_PIPES was set in the call to pex_init, and the system supports pipes

      2. if PEX_LAST is set in FLAGS, and OUTNAME is NULL

     Otherwise the code will use a file to hold standard output.  If PEX_LAST is not set, this file is considered to be a temporary file, and it will be removed when no longer needed, unless PEX_SAVE_TEMPS was set in the call to pex_init.

     There are two cases to consider when setting the name of the file to hold standard output.

      1. PEX_SUFFIX is set in FLAGS.  In this case OUTNAME may not be NULL.  If the TEMPBASE parameter to pex_init was not NULL, then the output file name is the concatenation of TEMPBASE and OUTNAME.  If TEMPBASE was NULL, then the output file name is a random file name ending in OUTNAME.

      2. PEX_SUFFIX was not set in FLAGS.  In this case, if OUTNAME is not NULL, it is used as the output file name.  If OUTNAME is NULL, and TEMPBASE was not NULL, the output file name is randomly chosen using TEMPBASE.  Otherwise the output file name is chosen completely at random.

     ERRNAME is the file name to use for standard error output.  If it is NULL, standard error is the same as the caller's. Otherwise, standard error is written to the named file.

     On an error return, the code sets *ERR to an errno value, or to 0 if there is no relevant errno.

 -- Extension: const char * pex_run_in_environment (struct pex_obj *OBJ, int FLAGS, const char *EXECUTABLE, char * const *ARGV, char * const *ENV, int ENV_SIZE, const char *OUTNAME, const char *ERRNAME, int *ERR)

     Execute one program in a pipeline, permitting the environment for the program to be specified.  Behaviour and parameters not listed below are as for pex_run.

     ENV is the environment for the child process, specified as an array of character pointers.  Each element of the array should point to a string of the form VAR=VALUE, with the exception of the last element that must be NULL.

 -- Extension: int pexecute (const char *PROGRAM, char * const *ARGV, const char *THIS_PNAME, const char *TEMP_BASE, char **ERRMSG_FMT, char **ERRMSG_ARG, int FLAGS)

     This is the old interface to execute one or more programs.  It is still supported for compatibility purposes, but is no longer documented.

 -- Supplemental: void psignal (int SIGNO, char *MESSAGE)

     Print MESSAGE to the standard error, followed by a colon, followed by the description of the signal specified by SIGNO, followed by a newline.

 -- Supplemental: int putenv (const char *STRING)

     Uses setenv or unsetenv to put STRING into the environment or remove it.  If STRING is of the form name=value the string is added; if no = is present the name is unset/removed.

 -- Extension: int pwait (int PID, int *STATUS, int FLAGS)

     Another part of the old execution interface.

 -- Supplement: long int random (void)
 -- Supplement: void srandom (unsigned int SEED)
 -- Supplement: void* initstate (unsigned int SEED, void *ARG_STATE, unsigned long N)
 -- Supplement: void* setstate (void *ARG_STATE)

     Random number functions.  random returns a random number in the range 0 to LONG_MAX.  srandom initializes the random number generator to some starting point determined by SEED (else, the values returned by random are always the same for each run of the program).  initstate and setstate allow fine-grained control over the state of the random number generator.

 -- Extension: char* reconcat (char *OPTR, const char *S1, ..., NULL)

     Same as concat, except that if OPTR is not NULL it is freed after the string is created.  This is intended to be useful when you're extending an existing string or building up a string in a loop:

            str = reconcat (str, "pre-", str, NULL);

 -- Supplemental: int rename (const char *OLD, const char *NEW)

     Renames a file from OLD to NEW.  If NEW already exists, it is removed.

 -- Supplemental: char* rindex (const char *S, int C)

     Returns a pointer to the last occurrence of the character C in the string S, or NULL if not found.  The use of rindex is deprecated in new programs in favor of strrchr.

 -- Supplemental: int setenv (const char *NAME, const char *VALUE, int OVERWRITE)
 -- Supplemental: void unsetenv (const char *NAME)

     setenv adds NAME to the environment with value VALUE.  If the name was already present in the environment, the new value will be stored only if OVERWRITE is nonzero. The companion unsetenv function removes NAME from the environment.  This implementation is not safe for multithreaded code.

 -- Extension: int signo_max (void)

     Returns the maximum signal value for which a corresponding symbolic name or message is available.  Note that in the case where we use the sys_siglist supplied by the system, it is possible for there to be more symbolic names than messages, or vice versa.  In fact, the manual page for psignal(3b) explicitly warns that one should check the size of the table (NSIG) before indexing it, since new signal codes may be added to the system before they are added to the table.  Thus NSIG might be smaller than value implied by the largest signo value defined in <signal.h>.

     We return the maximum value that can be used to obtain a meaningful symbolic name or message.

 -- Supplemental: int sigsetmask (int SET)

     Sets the signal mask to the one provided in SET and returns the old mask (which, for libiberty's implementation, will always be the value 1).

 -- Supplemental: int snprintf (char *BUF, size_t N, const char *FORMAT, ...)

     This function is similar to sprintf, but it will write to BUF at most N-1 bytes of text, followed by a terminating null byte, for a total of N bytes. On error the return value is -1, otherwise it returns the number of bytes, not including the terminating null byte, that would have been written had N been sufficiently large, regardless of the actual value of N.  Note some pre-C99 system libraries do not implement this correctly so users cannot generally rely on the return value if the system version of this function is used.

 -- Extension: char* spaces (int COUNT)

     Returns a pointer to a memory region filled with the specified number of spaces and null terminated.  The returned pointer is valid until at least the next call.

 -- Supplemental: char* stpcpy (char *DST, const char *SRC)

     Copies the string SRC into DST.  Returns a pointer to DST + strlen(SRC).

 -- Supplemental: char* stpncpy (char *DST, const char *SRC, size_t LEN)

     Copies the string SRC into DST, copying exactly LEN and padding with zeros if necessary.  If LEN < strlen(SRC) then return DST + LEN, otherwise returns DST + strlen(SRC).

 -- Supplemental: int strcasecmp (const char *S1, const char *S2)

     A case-insensitive strcmp.

 -- Supplemental: char* strchr (const char *S, int C)

     Returns a pointer to the first occurrence of the character C in the string S, or NULL if not found.  If C is itself the null character, the results are undefined.

 -- Supplemental: char* strdup (const char *S)

     Returns a pointer to a copy of S in memory obtained from malloc, or NULL if insufficient memory was available.

 -- Replacement: const char* strerrno (int ERRNUM)

     Given an error number returned from a system call (typically returned in errno), returns a pointer to a string containing the symbolic name of that error number, as found in <errno.h>.

     If the supplied error number is within the valid range of indices for symbolic names, but no name is available for the particular error number, then returns the string Error NUM, where NUM is the error number.

     If the supplied error number is not within the range of valid indices, then returns NULL.

     The contents of the location pointed to are only guaranteed to be valid until the next call to strerrno.

 -- Supplemental: char* strerror (int ERRNOVAL)

     Maps an errno number to an error message string, the contents of which are implementation defined.  On systems which have the external variables sys_nerr and sys_errlist, these strings will be the same as the ones used by perror.

     If the supplied error number is within the valid range of indices for the sys_errlist, but no message is available for the particular error number, then returns the string Error NUM, where NUM is the error number.

     If the supplied error number is not a valid index into sys_errlist, returns NULL.

     The returned string is only guaranteed to be valid only until the next call to strerror.

 -- Supplemental: int strncasecmp (const char *S1, const char *S2)

     A case-insensitive strncmp.

 -- Supplemental: int strncmp (const char *S1, const char *S2, size_t N)

     Compares the first N bytes of two strings, returning a value as strcmp.

 -- Extension: char* strndup (const char *S, size_t N)

     Returns a pointer to a copy of S with at most N characters in memory obtained from malloc, or NULL if insufficient memory was available.  The result is always NUL terminated.

 -- Supplemental: char* strrchr (const char *S, int C)

     Returns a pointer to the last occurrence of the character C in the string S, or NULL if not found.  If C is itself the null character, the results are undefined.

 -- Supplemental: const char * strsignal (int SIGNO)

     Maps an signal number to an signal message string, the contents of which are implementation defined.  On systems which have the external variable sys_siglist, these strings will be the same as the ones used by psignal().

     If the supplied signal number is within the valid range of indices for the sys_siglist, but no message is available for the particular signal number, then returns the string Signal NUM, where NUM is the signal number.

     If the supplied signal number is not a valid index into sys_siglist, returns NULL.

     The returned string is only guaranteed to be valid only until the next call to strsignal.

 -- Extension: const char* strsigno (int SIGNO)

     Given an signal number, returns a pointer to a string containing the symbolic name of that signal number, as found in <signal.h>.

     If the supplied signal number is within the valid range of indices for symbolic names, but no name is available for the particular signal number, then returns the string Signal NUM, where NUM is the signal number.

     If the supplied signal number is not within the range of valid indices, then returns NULL.

     The contents of the location pointed to are only guaranteed to be valid until the next call to strsigno.

 -- Supplemental: char* strstr (const char *STRING, const char *SUB)

     This function searches for the substring SUB in the string STRING, not including the terminating null characters.  A pointer to the first occurrence of SUB is returned, or NULL if the substring is absent.  If SUB points to a string with zero length, the function returns STRING.

 -- Supplemental: double strtod (const char *STRING, char **ENDPTR)

     This ISO C function converts the initial portion of STRING to a double.  If ENDPTR is not NULL, a pointer to the character after the last character used in the conversion is stored in the location referenced by ENDPTR.  If no conversion is performed, zero is returned and the value of STRING is stored in the location referenced by ENDPTR.

 -- Extension: int strtoerrno (const char *NAME)

     Given the symbolic name of a error number (e.g., EACCES), map it to an errno value.  If no translation is found, returns 0.

 -- Supplemental: long int strtol (const char *STRING, char **ENDPTR, int BASE)
 -- Supplemental: unsigned long int strtoul (const char *STRING, char **ENDPTR, int BASE)

     The strtol function converts the string in STRING to a long integer value according to the given BASE, which must be between 2 and 36 inclusive, or be the special value 0.  If BASE is 0, strtol will look for the prefixes 0 and 0x to indicate bases 8 and 16, respectively, else default to base 10. When the base is 16 (either explicitly or implicitly), a prefix of 0x is allowed.  The handling of ENDPTR is as that of strtod above.  The strtoul function is the same, except that the converted value is unsigned.

 -- Extension: int strtosigno (const char *NAME)

     Given the symbolic name of a signal, map it to a signal number.  If no translation is found, returns 0.

 -- Function: int strverscmp (const char *S1, const char *S2)
     The strverscmp function compares the string S1 against S2, considering them as holding indices/version numbers.  Return value follows the same conventions as found in the strverscmp function.  In fact, if S1 and S2 contain no digits, strverscmp behaves like strcmp.

     Basically, we compare strings normally (character by character), until we find a digit in each string - then we enter a special comparison mode, where each sequence of digits is taken as a whole.  If we reach the end of these two parts without noticing a difference, we return to the standard comparison mode.  There are two types of numeric parts: "integral" and "fractional" (those  begin with a '0'). The types of the numeric parts affect the way we sort them:

       * integral/integral: we compare values as you would expect.

       * fractional/integral: the fractional part is less than the integral one. Again, no surprise.

       * fractional/fractional: the things become a bit more complex. If the common prefix contains only leading zeroes, the longest part is less than the other one; else the comparison behaves normally.

          strverscmp ("no digit", "no digit")
              => 0    // same behavior as strcmp.
          strverscmp ("item#99", "item#100")
              => <0   // same prefix, but 99 < 100.
          strverscmp ("alpha1", "alpha001")
              => >0   // fractional part inferior to integral one.
          strverscmp ("part1_f012", "part1_f01")
              => >0   // two fractional parts.
          strverscmp ("foo.009", "foo.0")
              => <0   // idem, but with leading zeroes only.

     This function is especially useful when dealing with filename sorting, because filenames frequently hold indices/version numbers.

 -- Supplemental: char* tmpnam (char *S)

     This function attempts to create a name for a temporary file, which will be a valid file name yet not exist when tmpnam checks for it.  S must point to a buffer of at least L_tmpnam bytes, or be NULL.  Use of this function creates a security risk, and it must not be used in new projects.  Use mkstemp instead.

 -- Supplemental: int unlink_if_ordinary (const char*)

     Unlinks the named file, unless it is special (e.g. a device file). Returns 0 when the file was unlinked, a negative value (and errno set) when there was an error deleting the file, and a positive value if no attempt was made to unlink the file because it is special.

 -- Extension: void unlock_std_streams (void)

     If the OS supports it, ensure that the standard I/O streams, stdin, stdout and stderr are setup to avoid any multi-threaded locking.  Otherwise do nothing.

 -- Extension: void unlock_stream (FILE * STREAM)

     If the OS supports it, ensure that the supplied stream is setup to avoid any multi-threaded locking.  Otherwise leave the FILE pointer unchanged.  If the STREAM is NULL do nothing.

 -- Extension: int vasprintf (char **RESPTR, const char *FORMAT, va_list ARGS)

     Like vsprintf, but instead of passing a pointer to a buffer, you pass a pointer to a pointer.  This function will compute the size of the buffer needed, allocate memory with malloc, and store a pointer to the allocated memory in *RESPTR.  The value returned is the same as vsprintf would return.  If memory could not be allocated, minus one is returned and NULL is stored in *RESPTR.

 -- Supplemental: int vfork (void)

     Emulates vfork by calling fork and returning its value.

 -- Supplemental: int vprintf (const char *FORMAT, va_list AP)
 -- Supplemental: int vfprintf (FILE *STREAM, const char *FORMAT, va_list AP)
 -- Supplemental: int vsprintf (char *STR, const char *FORMAT, va_list AP)

     These functions are the same as printf, fprintf, and sprintf, respectively, except that they are called with a va_list instead of a variable number of arguments.  Note that they do not call va_end; this is the application's responsibility.  In libib they are implemented in terms of the nonstandard but common function _doprnt.

 -- Supplemental: int vsnprintf (char *BUF, size_t N, const char *FORMAT, va_list AP)

     This function is similar to vsprintf, but it will write to BUF at most N-1 bytes of text, followed by a terminating null byte, for a total of N bytes.  On error the return value is -1, otherwise it returns the number of characters that would have been printed had N been sufficiently large, regardless of the actual value of N.  Note some pre-C99 system libraries do not implement this correctly so users cannot generally rely on the return value if the system version of this function is used.

 -- Supplemental: int waitpid (int PID, int *STATUS, int)

     This is a wrapper around the wait function.  Any ``special'' values of PID depend on your implementation of wait, as does the return value.  The third argument is unused in libib.

 -- Extension: int writeargv (const char **ARGV, FILE *FILE)

     Write each member of ARGV, handling all necessary quoting, to the file named by FILE, separated by whitespace.  Return 0 on success, non-zero if an error occurred while writing to FILE.

 -- Function: int xatexit (void (*FN) (void))

     Behaves as the standard atexit function, but with no limit on the number of registered functions.  Returns 0 on success, or -1 on failure.  If you use xatexit to register functions, you must use xexit to terminate your program.

 -- Replacement: void* xcalloc (size_t NELEM, size_t ELSIZE)

     Allocate memory without fail, and set it to zero.  This routine functions like calloc, but will behave the same as xmalloc if memory cannot be found.

 -- Replacement: void xexit (int CODE)

     Terminates the program.  If any functions have been registered with the xatexit replacement function, they will be called first. Termination is handled via the system's normal exit call.

 -- Replacement: void* xmalloc (size_t)

     Allocate memory without fail.  If malloc fails, this will print a message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit.  Note that it is therefore safe for a program to contain #define malloc xmalloc in its source.

 -- Replacement: void xmalloc_failed (size_t)

     This function is not meant to be called by client code, and is listed here for completeness only.  If any of the allocation routines fail, this function will be called to print an error message and terminate execution.

 -- Replacement: void xmalloc_set_program_name (const char *NAME)

     You can use this to set the name of the program used by xmalloc_failed when printing a failure message.

 -- Replacement: void* xmemdup (void *INPUT, size_t COPY_SIZE, size_t ALLOC_SIZE)

     Duplicates a region of memory without fail.  First, ALLOC_SIZE bytes are allocated, then COPY_SIZE bytes from INPUT are copied into it, and the new memory is returned.  If fewer bytes are copied than were allocated, the remaining memory is zeroed.

 -- Replacement: void* xrealloc (void *PTR, size_t SIZE)
     Reallocate memory without fail.  This routine functions like realloc, but will behave the same as xmalloc if memory cannot be found.

 -- Replacement: char* xstrdup (const char *S)

     Duplicates a character string without fail, using xmalloc to obtain memory.

 -- Replacement: char* xstrerror (int ERRNUM)

     Behaves exactly like the standard strerror function, but will never return a NULL pointer.

 -- Replacement: char* xstrndup (const char *S, size_t N)

     Returns a pointer to a copy of S with at most N characters without fail, using xmalloc to obtain memory.  The result is always NUL terminated.