void* alloca (size_t size) | Replacement |
This function allocates memory which will be automatically reclaimed
after the procedure exits. The The header file |
int asprintf (char **resptr, const char *format, ...) | Extension |
Like |
int atexit (void (*f)()) | Supplemental |
Causes function f to be called at exit. Returns 0. |
char* basename (const char *name) | Supplemental |
Returns a pointer to the last component of pathname name. Behavior is undefined if the pathname ends in a directory separator. |
int bcmp (char *x, char *y, int count) | Supplemental |
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). |
void bcopy (char *in, char *out, int length) | Supplemental |
Copies length bytes from memory region in to region
out. The use of |
void* bsearch (const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) | Supplemental |
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. |
char** buildargv (char *sp) | Extension |
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
All of the memory for the pointer array and copies of the string
is obtained from Returns a pointer to the argument vector if successful. Returns
If the input is a null string (as opposed to a |
void bzero (char *mem, int count) | Supplemental |
Zeros count bytes starting at mem. Use of this function
is deprecated in favor of |
void* calloc (size_t nelem, size_t elsize) | Supplemental |
Uses |
char* choose_temp_base (void) | Extension |
Return a prefix for temporary file names or This function is provided for backwards compatability only. Its use is not recommended. |
char* choose_tmpdir () | Replacement |
Returns a pointer to a directory path suitable for creating temporary files in. |
long clock (void) | Supplemental |
Returns an approximation of the CPU time used by the process as a
|
char* concat (const char *s1, const char *s2, ..., NULL )
|
Extension |
Concatenate zero or more of strings and return the result in freshly
|
char** dupargv (char **vector) | Extension |
Duplicate an argument vector. Simply scans through vector,
duplicating each argument until the terminating |
int errno_max (void) | Extension |
Returns the maximum We return the maximum value that can be used to obtain a meaningful symbolic name or message. |
int fdmatch (int fd1, int fd2) | Extension |
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 ( |
int ffs (int valu) | Supplemental |
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. |
int fnmatch (const char *pattern, const char *string, int flags) | Replacement |
Matches string against pattern, returning zero if it
matches,
|
void freeargv (char **vector) | Extension |
Free an argument vector that was built using |
long get_run_time (void) | Replacement |
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. |
char* getcwd (char *pathname, int len) | Supplemental |
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
|
int getpagesize (void) | Supplemental |
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. |
char* getpwd (void) | Supplemental |
Returns the current working directory. This implementation caches the
result on the assumption that the process will not call |
char* index (char *s, int c) | Supplemental |
Returns a pointer to the first occurrence of the character c in
the string s, or |
void insque (struct qelem *elem, struct qelem *pred) | Supplemental |
void remque (struct qelem *elem) | Supplemental |
Routines to manipulate queues built from doubly linked lists. The
struct qelem { struct qelem *q_forw; struct qelem *q_back; char q_data[]; }; |
const char* lbasename (const char *name) | Replacement |
Given a pointer to a string containing a typical pathname
( In particular, the empty string returns the same empty string,
and a path ending in |
char* make_temp_file (const char *suffix) | Replacement |
Return a temporary file name (as a string) or |
void* memchr (const void *s, int c, size_t n) | Supplemental |
This function searches memory starting at |
int memcmp (const void *x, const void *y, size_t count) | Supplemental |
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. |
void* memcpy (void *out, const void *in, size_t length) | Supplemental |
Copies length bytes from memory region in to region out. Returns a pointer to out. |
void* memmove (void *from, const void *to, size_t count) | Supplemental |
Copies count bytes from memory area from to memory area to, returning a pointer to to. |
void* memset (void *s, int c, size_t count) | Supplemental |
Sets the first count bytes of s to the constant byte c, returning a pointer to s. |
int mkstemps (char *template, int suffix_len) | Replacement |
Generate a unique temporary file name from template. template has the form: path/ccXXXXXXsuffix suffix_len tells us how long suffix is (it can be zero
length). The last six characters of template before suffix
must be |
int pexecute (const char *program, char * const *argv, const char *this_pname, const char *temp_base, char **errmsg_fmt, char **errmsg_arg, int flags) | Extension |
Executes a program. program and argv are the arguments to
this_pname is name of the calling program (i.e., temp_base is the path name, sans suffix, of a temporary file to
use if needed. This is currently only needed for MS-DOS ports that
don't use ( The result is the pid on systems like Unix where we
The result is the Upon failure, errmsg_fmt and errmsg_arg are set to the
text of the error message with an optional argument (if not needed,
errmsg_arg is set to |
void psignal (unsigned signo, char *message) | Supplemental |
Print message to the standard error, followed by a colon, followed by the description of the signal specified by signo, followed by a newline. |
int putenv (const char *string) | Supplemental |
Uses |
int pwait (int pid, int *status, int flags) | Extension |
Waits for a program started by pid is the process id of the task to wait for. status is the `status' argument to wait. flags is currently unused (allows future enhancement without breaking upward compatibility). Pass 0 for now. The result is the pid of the child reaped, or -1 for failure
( On systems that don't support waiting for a particular child, pid is
ignored. On systems like MS-DOS that don't really multitask |
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) | Supplement |
Random number functions. |
char* reconcat (char *optr, const char *s1, ..., NULL )
|
Extension |
Same as str = reconcat (str, "pre-", str, NULL); |
int rename (const char *old, const char *new) | Supplemental |
Renames a file from old to new. If new already exists, it is removed. |
char* rindex (const char *s, int c) | Supplemental |
Returns a pointer to the last occurrence of the character c in
the string s, or |
int setenv (const char *name, const char *value, int overwrite) | Supplemental |
void unsetenv (const char *name) | Supplemental |
|
int signo_max (void) | Extension |
Returns the maximum signal value for which a corresponding symbolic
name or message is available. Note that in the case where we use the
We return the maximum value that can be used to obtain a meaningful symbolic name or message. |
int sigsetmask (int set) | Supplemental |
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 |
char* spaces (int count) | Extension |
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. |
int strcasecmp (const char *s1, const char *s2) | Supplemental |
A case-insensitive |
char* strchr (const char *s, int c) | Supplemental |
Returns a pointer to the first occurrence of the character c in
the string s, or |
char* strdup (const char *s) | Supplemental |
Returns a pointer to a copy of s in memory obtained from
|
const char* strerrno (int errnum) | Replacement |
Given an error number returned from a system call (typically returned
in 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 If the supplied error number is not within the range of valid
indices, then returns The contents of the location pointed to are only guaranteed to be
valid until the next call to |
char* strerror (int errnoval) | Supplemental |
Maps an If the supplied error number is within the valid range of indices for
the If the supplied error number is not a valid index into
The returned string is only guaranteed to be valid only until the
next call to |
int strncasecmp (const char *s1, const char *s2) | Supplemental |
A case-insensitive |
int strncmp (const char *s1, const char *s2, size_t n) | Supplemental |
Compares the first n bytes of two strings, returning a value as
|
char* strrchr (const char *s, int c) | Supplemental |
Returns a pointer to the last occurrence of the character c in
the string s, or |
const char * strsignal (int signo) | Supplemental |
Maps an signal number to an signal message string, the contents of
which are implementation defined. On systems which have the external
variable If the supplied signal number is within the valid range of indices for
the If the supplied signal number is not a valid index into
The returned string is only guaranteed to be valid only until the next
call to |
const char* strsigno (int signo) | Extension |
Given an signal number, returns a pointer to a string containing the
symbolic name of that signal number, as found in 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 If the supplied signal number is not within the range of valid
indices, then returns The contents of the location pointed to are only guaranteed to be
valid until the next call to |
char* strstr (const char *string, const char *sub) | Supplemental |
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 |
double strtod (const char *string, char **endptr) | Supplemental |
This ISO C function converts the initial portion of string to a
|
int strtoerrno (const char *name) | Extension |
Given the symbolic name of a error number (e.g., |
long int strtol (const char *string, char **endptr, int base) | Supplemental |
unsigned long int strtoul (const char *string, char **endptr, int base) | Supplemental |
The |
int strtosigno (const char *name) | Extension |
Given the symbolic name of a signal, map it to a signal number. If no translation is found, returns 0. |
char* tmpnam (char *s) | Supplemental |
This function attempts to create a name for a temporary file, which
will be a valid file name yet not exist when |
int vasprintf (char **resptr, const char *format, va_list args) | Extension |
Like |
int vfork (void) | Supplemental |
Emulates |
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) | Supplemental |
These functions are the same as |
int waitpid (int pid, int *status, int) | Supplemental |
This is a wrapper around the |
int xatexit (void (*fn) (void)) | Function |
Behaves as the standard |
void* xcalloc (size_t nelem, size_t elsize) | Replacement |
Allocate memory without fail, and set it to zero. This routine functions
like |
void xexit (int code) | Replacement |
Terminates the program. If any functions have been registered with
the |
void* xmalloc (size_t) | Replacement |
Allocate memory without fail. If |
void xmalloc_failed (size_t) | Replacement |
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. |
void xmalloc_set_program_name (const char *name) | Replacement |
You can use this to set the name of the program used by
|
void* xmemdup (void *input, size_t copy_size, size_t alloc_size) | Replacement |
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. |
void* xrealloc (void *ptr, size_t size) | Replacement |
Reallocate memory without fail. This routine functions like realloc ,
but will behave the same as xmalloc if memory cannot be found.
|
char* xstrdup (const char *s) | Replacement |
Duplicates a character string without fail, using |
char* xstrerror (int errnum) | Replacement |
Behaves exactly like the standard |