@c Automatically generated from *.c and others (the comments before
|
@c Automatically generated from *.c and others (the comments before
|
@c each entry tell you which file and where in that file). DO NOT EDIT!
|
@c each entry tell you which file and where in that file). DO NOT EDIT!
|
@c Edit the *.c files, configure with --enable-maintainer-mode,
|
@c Edit the *.c files, configure with --enable-maintainer-mode,
|
@c run 'make stamp-functions' and gather-docs will build a new copy.
|
@c run 'make stamp-functions' and gather-docs will build a new copy.
|
|
|
@c safe-ctype.c:25
|
@c safe-ctype.c:25
|
@defvr Extension HOST_CHARSET
|
@defvr Extension HOST_CHARSET
|
This macro indicates the basic character set and encoding used by the
|
This macro indicates the basic character set and encoding used by the
|
host: more precisely, the encoding used for character constants in
|
host: more precisely, the encoding used for character constants in
|
preprocessor @samp{#if} statements (the C "execution character set").
|
preprocessor @samp{#if} statements (the C "execution character set").
|
It is defined by @file{safe-ctype.h}, and will be an integer constant
|
It is defined by @file{safe-ctype.h}, and will be an integer constant
|
with one of the following values:
|
with one of the following values:
|
|
|
@ftable @code
|
@ftable @code
|
@item HOST_CHARSET_UNKNOWN
|
@item HOST_CHARSET_UNKNOWN
|
The host character set is unknown - that is, not one of the next two
|
The host character set is unknown - that is, not one of the next two
|
possibilities.
|
possibilities.
|
|
|
@item HOST_CHARSET_ASCII
|
@item HOST_CHARSET_ASCII
|
The host character set is ASCII.
|
The host character set is ASCII.
|
|
|
@item HOST_CHARSET_EBCDIC
|
@item HOST_CHARSET_EBCDIC
|
The host character set is some variant of EBCDIC. (Only one of the
|
The host character set is some variant of EBCDIC. (Only one of the
|
nineteen EBCDIC varying characters is tested; exercise caution.)
|
nineteen EBCDIC varying characters is tested; exercise caution.)
|
@end ftable
|
@end ftable
|
@end defvr
|
@end defvr
|
|
|
@c alloca.c:26
|
@c alloca.c:26
|
@deftypefn Replacement void* alloca (size_t @var{size})
|
@deftypefn Replacement void* alloca (size_t @var{size})
|
|
|
This function allocates memory which will be automatically reclaimed
|
This function allocates memory which will be automatically reclaimed
|
after the procedure exits. The @libib{} implementation does not free
|
after the procedure exits. The @libib{} implementation does not free
|
the memory immediately but will do so eventually during subsequent
|
the memory immediately but will do so eventually during subsequent
|
calls to this function. Memory is allocated using @code{xmalloc} under
|
calls to this function. Memory is allocated using @code{xmalloc} under
|
normal circumstances.
|
normal circumstances.
|
|
|
The header file @file{alloca-conf.h} can be used in conjunction with the
|
The header file @file{alloca-conf.h} can be used in conjunction with the
|
GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
|
GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
|
available this function. The @code{AC_FUNC_ALLOCA} test requires that
|
available this function. The @code{AC_FUNC_ALLOCA} test requires that
|
client code use a block of preprocessor code to be safe (see the Autoconf
|
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
|
manual for more); this header incorporates that logic and more, including
|
the possibility of a GCC built-in function.
|
the possibility of a GCC built-in function.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c asprintf.c:32
|
@c asprintf.c:32
|
@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
|
@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
|
|
|
Like @code{sprintf}, but instead of passing a pointer to a buffer, you
|
Like @code{sprintf}, but instead of passing a pointer to a buffer, you
|
pass a pointer to a pointer. This function will compute the size of
|
pass a pointer to a pointer. This function will compute the size of
|
the buffer needed, allocate memory with @code{malloc}, and store a
|
the buffer needed, allocate memory with @code{malloc}, and store a
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
returned is the same as @code{sprintf} would return. If memory could
|
returned is the same as @code{sprintf} would return. If memory could
|
not be allocated, minus one is returned and @code{NULL} is stored in
|
not be allocated, minus one is returned and @code{NULL} is stored in
|
@code{*@var{resptr}}.
|
@code{*@var{resptr}}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c atexit.c:6
|
@c atexit.c:6
|
@deftypefn Supplemental int atexit (void (*@var{f})())
|
@deftypefn Supplemental int atexit (void (*@var{f})())
|
|
|
Causes function @var{f} to be called at exit. Returns 0.
|
Causes function @var{f} to be called at exit. Returns 0.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c basename.c:6
|
@c basename.c:6
|
@deftypefn Supplemental char* basename (const char *@var{name})
|
@deftypefn Supplemental char* basename (const char *@var{name})
|
|
|
Returns a pointer to the last component of pathname @var{name}.
|
Returns a pointer to the last component of pathname @var{name}.
|
Behavior is undefined if the pathname ends in a directory separator.
|
Behavior is undefined if the pathname ends in a directory separator.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c bcmp.c:6
|
@c bcmp.c:6
|
@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
|
@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
|
|
|
Compares the first @var{count} bytes of two areas of memory. Returns
|
Compares the first @var{count} bytes of two areas of memory. Returns
|
zero if they are the same, nonzero otherwise. Returns zero if
|
zero if they are the same, nonzero otherwise. Returns zero if
|
@var{count} is zero. A nonzero result only indicates a difference,
|
@var{count} is zero. A nonzero result only indicates a difference,
|
it does not indicate any sorting order (say, by having a positive
|
it does not indicate any sorting order (say, by having a positive
|
result mean @var{x} sorts before @var{y}).
|
result mean @var{x} sorts before @var{y}).
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c bcopy.c:3
|
@c bcopy.c:3
|
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
|
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
|
|
|
Copies @var{length} bytes from memory region @var{in} to region
|
Copies @var{length} bytes from memory region @var{in} to region
|
@var{out}. The use of @code{bcopy} is deprecated in new programs.
|
@var{out}. The use of @code{bcopy} is deprecated in new programs.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c bsearch.c:33
|
@c bsearch.c:33
|
@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
|
@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
|
|
|
Performs a search over an array of @var{nmemb} elements pointed to by
|
Performs a search over an array of @var{nmemb} elements pointed to by
|
@var{base} for a member that matches the object pointed to by @var{key}.
|
@var{base} for a member that matches the object pointed to by @var{key}.
|
The size of each member is specified by @var{size}. The array contents
|
The size of each member is specified by @var{size}. The array contents
|
should be sorted in ascending order according to the @var{compar}
|
should be sorted in ascending order according to the @var{compar}
|
comparison function. This routine should take two arguments pointing to
|
comparison function. This routine should take two arguments pointing to
|
the @var{key} and to an array member, in that order, and should return an
|
the @var{key} and to an array member, in that order, and should return an
|
integer less than, equal to, or greater than zero if the @var{key} object
|
integer less than, equal to, or greater than zero if the @var{key} object
|
is respectively less than, matching, or greater than the array member.
|
is respectively less than, matching, or greater than the array member.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c argv.c:142
|
@c argv.c:142
|
@deftypefn Extension char** buildargv (char *@var{sp})
|
@deftypefn Extension char** buildargv (char *@var{sp})
|
|
|
Given a pointer to a string, parse the string extracting fields
|
Given a pointer to a string, parse the string extracting fields
|
separated by whitespace and optionally enclosed within either single
|
separated by whitespace and optionally enclosed within either single
|
or double quotes (which are stripped off), and build a vector of
|
or double quotes (which are stripped off), and build a vector of
|
pointers to copies of the string for each field. The input string
|
pointers to copies of the string for each field. The input string
|
remains unchanged. The last element of the vector is followed by a
|
remains unchanged. The last element of the vector is followed by a
|
@code{NULL} element.
|
@code{NULL} element.
|
|
|
All of the memory for the pointer array and copies of the string
|
All of the memory for the pointer array and copies of the string
|
is obtained from @code{malloc}. All of the memory can be returned to the
|
is obtained from @code{malloc}. All of the memory can be returned to the
|
system with the single function call @code{freeargv}, which takes the
|
system with the single function call @code{freeargv}, which takes the
|
returned result of @code{buildargv}, as it's argument.
|
returned result of @code{buildargv}, as it's argument.
|
|
|
Returns a pointer to the argument vector if successful. Returns
|
Returns a pointer to the argument vector if successful. Returns
|
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
memory to complete building the argument vector.
|
memory to complete building the argument vector.
|
|
|
If the input is a null string (as opposed to a @code{NULL} pointer),
|
If the input is a null string (as opposed to a @code{NULL} pointer),
|
then buildarg returns an argument vector that has one arg, a null
|
then buildarg returns an argument vector that has one arg, a null
|
string.
|
string.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c bzero.c:6
|
@c bzero.c:6
|
@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
|
@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
|
|
|
Zeros @var{count} bytes starting at @var{mem}. Use of this function
|
Zeros @var{count} bytes starting at @var{mem}. Use of this function
|
is deprecated in favor of @code{memset}.
|
is deprecated in favor of @code{memset}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c calloc.c:6
|
@c calloc.c:6
|
@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
|
@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
|
|
|
Uses @code{malloc} to allocate storage for @var{nelem} objects of
|
Uses @code{malloc} to allocate storage for @var{nelem} objects of
|
@var{elsize} bytes each, then zeros the memory.
|
@var{elsize} bytes each, then zeros the memory.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c choose-temp.c:46
|
@c choose-temp.c:46
|
@deftypefn Extension char* choose_temp_base (void)
|
@deftypefn Extension char* choose_temp_base (void)
|
|
|
Return a prefix for temporary file names or @code{NULL} if unable to
|
Return a prefix for temporary file names or @code{NULL} if unable to
|
find one. The current directory is chosen if all else fails so the
|
find one. The current directory is chosen if all else fails so the
|
program is exited if a temporary directory can't be found (@code{mktemp}
|
program is exited if a temporary directory can't be found (@code{mktemp}
|
fails). The buffer for the result is obtained with @code{xmalloc}.
|
fails). The buffer for the result is obtained with @code{xmalloc}.
|
|
|
This function is provided for backwards compatibility only. Its use is
|
This function is provided for backwards compatibility only. Its use is
|
not recommended.
|
not recommended.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c make-temp-file.c:95
|
@c make-temp-file.c:95
|
@deftypefn Replacement char* choose_tmpdir ()
|
@deftypefn Replacement char* choose_tmpdir ()
|
|
|
Returns a pointer to a directory path suitable for creating temporary
|
Returns a pointer to a directory path suitable for creating temporary
|
files in.
|
files in.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c clock.c:27
|
@c clock.c:27
|
@deftypefn Supplemental long clock (void)
|
@deftypefn Supplemental long clock (void)
|
|
|
Returns an approximation of the CPU time used by the process as a
|
Returns an approximation of the CPU time used by the process as a
|
@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
|
@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
|
number of seconds used.
|
number of seconds used.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c concat.c:24
|
@c concat.c:24
|
@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
|
@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
|
|
|
Concatenate zero or more of strings and return the result in freshly
|
Concatenate zero or more of strings and return the result in freshly
|
@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
|
@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
|
available. The argument list is terminated by the first @code{NULL}
|
available. The argument list is terminated by the first @code{NULL}
|
pointer encountered. Pointers to empty strings are ignored.
|
pointer encountered. Pointers to empty strings are ignored.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c crc32.c:141
|
@c crc32.c:141
|
@deftypefn Extension unsigned int crc32 (const unsigned char *@var{buf}, int @var{len}, unsigned int @var{init})
|
@deftypefn Extension unsigned int crc32 (const unsigned char *@var{buf}, int @var{len}, unsigned int @var{init})
|
|
|
Compute the 32-bit CRC of @var{buf} which has length @var{len}. The
|
Compute the 32-bit CRC of @var{buf} which has length @var{len}. The
|
starting value is @var{init}; this may be used to compute the CRC of
|
starting value is @var{init}; this may be used to compute the CRC of
|
data split across multiple buffers by passing the return value of each
|
data split across multiple buffers by passing the return value of each
|
call as the @var{init} parameter of the next.
|
call as the @var{init} parameter of the next.
|
|
|
This is intended to match the CRC used by the @command{gdb} remote
|
This is intended to match the CRC used by the @command{gdb} remote
|
protocol for the @samp{qCRC} command. In order to get the same
|
protocol for the @samp{qCRC} command. In order to get the same
|
results as gdb for a block of data, you must pass the first CRC
|
results as gdb for a block of data, you must pass the first CRC
|
parameter as @code{0xffffffff}.
|
parameter as @code{0xffffffff}.
|
|
|
This CRC can be specified as:
|
This CRC can be specified as:
|
|
|
Width : 32
|
Width : 32
|
Poly : 0x04c11db7
|
Poly : 0x04c11db7
|
Init : parameter, typically 0xffffffff
|
Init : parameter, typically 0xffffffff
|
RefIn : false
|
RefIn : false
|
RefOut : false
|
RefOut : false
|
XorOut : 0
|
XorOut : 0
|
|
|
This differs from the "standard" CRC-32 algorithm in that the values
|
This differs from the "standard" CRC-32 algorithm in that the values
|
are not reflected, and there is no final XOR value. These differences
|
are not reflected, and there is no final XOR value. These differences
|
make it easy to compose the values of multiple blocks.
|
make it easy to compose the values of multiple blocks.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c argv.c:52
|
@c argv.c:52
|
@deftypefn Extension char** dupargv (char **@var{vector})
|
@deftypefn Extension char** dupargv (char **@var{vector})
|
|
|
Duplicate an argument vector. Simply scans through @var{vector},
|
Duplicate an argument vector. Simply scans through @var{vector},
|
duplicating each argument until the terminating @code{NULL} is found.
|
duplicating each argument until the terminating @code{NULL} is found.
|
Returns a pointer to the argument vector if successful. Returns
|
Returns a pointer to the argument vector if successful. Returns
|
@code{NULL} if there is insufficient memory to complete building the
|
@code{NULL} if there is insufficient memory to complete building the
|
argument vector.
|
argument vector.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strerror.c:567
|
@c strerror.c:567
|
@deftypefn Extension int errno_max (void)
|
@deftypefn Extension int errno_max (void)
|
|
|
Returns the maximum @code{errno} value for which a corresponding
|
Returns the maximum @code{errno} value for which a corresponding
|
symbolic name or message is available. Note that in the case where we
|
symbolic name or message is available. Note that in the case where we
|
use the @code{sys_errlist} supplied by the system, it is possible for
|
use the @code{sys_errlist} supplied by the system, it is possible for
|
there to be more symbolic names than messages, or vice versa. In
|
there to be more symbolic names than messages, or vice versa. In
|
fact, the manual page for @code{perror(3C)} explicitly warns that one
|
fact, the manual page for @code{perror(3C)} explicitly warns that one
|
should check the size of the table (@code{sys_nerr}) before indexing
|
should check the size of the table (@code{sys_nerr}) before indexing
|
it, since new error codes may be added to the system before they are
|
it, since new error codes may be added to the system before they are
|
added to the table. Thus @code{sys_nerr} might be smaller than value
|
added to the table. Thus @code{sys_nerr} might be smaller than value
|
implied by the largest @code{errno} value defined in @code{<errno.h>}.
|
implied by the largest @code{errno} value defined in @code{<errno.h>}.
|
|
|
We return the maximum value that can be used to obtain a meaningful
|
We return the maximum value that can be used to obtain a meaningful
|
symbolic name or message.
|
symbolic name or message.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c argv.c:361
|
@c argv.c:361
|
@deftypefn Extension void expandargv (int *@var{argcp}, char ***@var{argvp})
|
@deftypefn Extension void expandargv (int *@var{argcp}, char ***@var{argvp})
|
|
|
The @var{argcp} and @code{argvp} arguments are pointers to the usual
|
The @var{argcp} and @code{argvp} arguments are pointers to the usual
|
@code{argc} and @code{argv} arguments to @code{main}. This function
|
@code{argc} and @code{argv} arguments to @code{main}. This function
|
looks for arguments that begin with the character @samp{@@}. Any such
|
looks for arguments that begin with the character @samp{@@}. Any such
|
arguments are interpreted as ``response files''. The contents of the
|
arguments are interpreted as ``response files''. The contents of the
|
response file are interpreted as additional command line options. In
|
response file are interpreted as additional command line options. In
|
particular, the file is separated into whitespace-separated strings;
|
particular, the file is separated into whitespace-separated strings;
|
each such string is taken as a command-line option. The new options
|
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
|
are inserted in place of the option naming the response file, and
|
@code{*argcp} and @code{*argvp} will be updated. If the value of
|
@code{*argcp} and @code{*argvp} will be updated. If the value of
|
@code{*argvp} is modified by this function, then the new value has
|
@code{*argvp} is modified by this function, then the new value has
|
been dynamically allocated and can be deallocated by the caller with
|
been dynamically allocated and can be deallocated by the caller with
|
@code{freeargv}. However, most callers will simply call
|
@code{freeargv}. However, most callers will simply call
|
@code{expandargv} near the beginning of @code{main} and allow the
|
@code{expandargv} near the beginning of @code{main} and allow the
|
operating system to free the memory when the program exits.
|
operating system to free the memory when the program exits.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fdmatch.c:23
|
@c fdmatch.c:23
|
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
|
|
Check to see if two open file descriptors refer to the same file.
|
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
|
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
|
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
|
to that fd. This can happen when we are exec'd with an already open
|
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
that return open file descriptors for mapped address spaces. All we
|
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
|
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
|
for a match, which is done by comparing major and minor device numbers
|
and inode numbers.
|
and inode numbers.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fopen_unlocked.c:48
|
@c fopen_unlocked.c:48
|
@deftypefn Extension {FILE *} fdopen_unlocked (int @var{fildes}, const char * @var{mode})
|
@deftypefn Extension {FILE *} fdopen_unlocked (int @var{fildes}, const char * @var{mode})
|
|
|
Opens and returns a @code{FILE} pointer via @code{fdopen}. If the
|
Opens and returns a @code{FILE} pointer via @code{fdopen}. If the
|
operating system supports it, ensure that the stream is setup to avoid
|
operating system supports it, ensure that the stream is setup to avoid
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
unchanged.
|
unchanged.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c ffs.c:3
|
@c ffs.c:3
|
@deftypefn Supplemental int ffs (int @var{valu})
|
@deftypefn Supplemental int ffs (int @var{valu})
|
|
|
Find the first (least significant) bit set in @var{valu}. Bits are
|
Find the first (least significant) bit set in @var{valu}. Bits are
|
numbered from right to left, starting with bit 1 (corresponding to the
|
numbered from right to left, starting with bit 1 (corresponding to the
|
value 1). If @var{valu} is zero, zero is returned.
|
value 1). If @var{valu} is zero, zero is returned.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c filename_cmp.c:32
|
@c filename_cmp.c:32
|
@deftypefn Extension int filename_cmp (const char *@var{s1}, const char *@var{s2})
|
@deftypefn Extension int filename_cmp (const char *@var{s1}, const char *@var{s2})
|
|
|
Return zero if the two file names @var{s1} and @var{s2} are equivalent.
|
Return zero if the two file names @var{s1} and @var{s2} are equivalent.
|
If not equivalent, the returned value is similar to what @code{strcmp}
|
If not equivalent, the returned value is similar to what @code{strcmp}
|
would return. In other words, it returns a negative value if @var{s1}
|
would return. In other words, it returns a negative value if @var{s1}
|
is less than @var{s2}, or a positive value if @var{s2} is greater than
|
is less than @var{s2}, or a positive value if @var{s2} is greater than
|
@var{s2}.
|
@var{s2}.
|
|
|
This function does not normalize file names. As a result, this function
|
This function does not normalize file names. As a result, this function
|
will treat filenames that are spelled differently as different even in
|
will treat filenames that are spelled differently as different even in
|
the case when the two filenames point to the same underlying file.
|
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
|
However, it does handle the fact that on DOS-like file systems, forward
|
and backward slashes are equal.
|
and backward slashes are equal.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fnmatch.txh:1
|
@c fnmatch.txh:1
|
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
|
|
Matches @var{string} against @var{pattern}, returning zero if it
|
Matches @var{string} against @var{pattern}, returning zero if it
|
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
wildcards @code{?} to match any one character, @code{*} to match any
|
wildcards @code{?} to match any one character, @code{*} to match any
|
zero or more characters, or a set of alternate characters in square
|
zero or more characters, or a set of alternate characters in square
|
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
character is in the set. A set may be inverted (i.e., match anything
|
character is in the set. A set may be inverted (i.e., match anything
|
except what's in the set) by giving @code{^} or @code{!} as the first
|
except what's in the set) by giving @code{^} or @code{!} as the first
|
character in the set. To include those characters in the set, list them
|
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
|
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
|
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
|
the following character not special, so for example you could match
|
against a literal asterisk with @samp{\*}. To match a literal
|
against a literal asterisk with @samp{\*}. To match a literal
|
backslash, use @samp{\\}.
|
backslash, use @samp{\\}.
|
|
|
@code{flags} controls various aspects of the matching process, and is a
|
@code{flags} controls various aspects of the matching process, and is a
|
boolean OR of zero or more of the following values (defined in
|
boolean OR of zero or more of the following values (defined in
|
@code{<fnmatch.h>}):
|
@code{<fnmatch.h>}):
|
|
|
@table @code
|
@table @code
|
|
|
@item FNM_PATHNAME
|
@item FNM_PATHNAME
|
@itemx FNM_FILE_NAME
|
@itemx FNM_FILE_NAME
|
@var{string} is assumed to be a path name. No wildcard will ever match
|
@var{string} is assumed to be a path name. No wildcard will ever match
|
@code{/}.
|
@code{/}.
|
|
|
@item FNM_NOESCAPE
|
@item FNM_NOESCAPE
|
Do not interpret backslashes as quoting the following special character.
|
Do not interpret backslashes as quoting the following special character.
|
|
|
@item FNM_PERIOD
|
@item FNM_PERIOD
|
A leading period (at the beginning of @var{string}, or if
|
A leading period (at the beginning of @var{string}, or if
|
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
@code{?} but must be matched explicitly.
|
@code{?} but must be matched explicitly.
|
|
|
@item FNM_LEADING_DIR
|
@item FNM_LEADING_DIR
|
Means that @var{string} also matches @var{pattern} if some initial part
|
Means that @var{string} also matches @var{pattern} if some initial part
|
of @var{string} matches, and is followed by @code{/} and zero or more
|
of @var{string} matches, and is followed by @code{/} and zero or more
|
characters. For example, @samp{foo*} would match either @samp{foobar}
|
characters. For example, @samp{foo*} would match either @samp{foobar}
|
or @samp{foobar/grill}.
|
or @samp{foobar/grill}.
|
|
|
@item FNM_CASEFOLD
|
@item FNM_CASEFOLD
|
Ignores case when performing the comparison.
|
Ignores case when performing the comparison.
|
|
|
@end table
|
@end table
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fopen_unlocked.c:39
|
@c fopen_unlocked.c:39
|
@deftypefn Extension {FILE *} fopen_unlocked (const char *@var{path}, const char * @var{mode})
|
@deftypefn Extension {FILE *} fopen_unlocked (const char *@var{path}, const char * @var{mode})
|
|
|
Opens and returns a @code{FILE} pointer via @code{fopen}. If the
|
Opens and returns a @code{FILE} pointer via @code{fopen}. If the
|
operating system supports it, ensure that the stream is setup to avoid
|
operating system supports it, ensure that the stream is setup to avoid
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
unchanged.
|
unchanged.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c argv.c:97
|
@c argv.c:97
|
@deftypefn Extension void freeargv (char **@var{vector})
|
@deftypefn Extension void freeargv (char **@var{vector})
|
|
|
Free an argument vector that was built using @code{buildargv}. Simply
|
Free an argument vector that was built using @code{buildargv}. Simply
|
scans through @var{vector}, freeing the memory for each argument until
|
scans through @var{vector}, freeing the memory for each argument until
|
the terminating @code{NULL} is found, and then frees @var{vector}
|
the terminating @code{NULL} is found, and then frees @var{vector}
|
itself.
|
itself.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fopen_unlocked.c:57
|
@c fopen_unlocked.c:57
|
@deftypefn Extension {FILE *} freopen_unlocked (const char * @var{path}, const char * @var{mode}, FILE * @var{stream})
|
@deftypefn Extension {FILE *} freopen_unlocked (const char * @var{path}, const char * @var{mode}, FILE * @var{stream})
|
|
|
Opens and returns a @code{FILE} pointer via @code{freopen}. If the
|
Opens and returns a @code{FILE} pointer via @code{freopen}. If the
|
operating system supports it, ensure that the stream is setup to avoid
|
operating system supports it, ensure that the stream is setup to avoid
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
any multi-threaded locking. Otherwise return the @code{FILE} pointer
|
unchanged.
|
unchanged.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c getruntime.c:82
|
@c getruntime.c:82
|
@deftypefn Replacement long get_run_time (void)
|
@deftypefn Replacement long get_run_time (void)
|
|
|
Returns the time used so far, in microseconds. If possible, this is
|
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
|
the time used by this process, else it is the elapsed time since the
|
process started.
|
process started.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c getcwd.c:6
|
@c getcwd.c:6
|
@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
|
@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
|
|
|
Copy the absolute pathname for the current working directory into
|
Copy the absolute pathname for the current working directory into
|
@var{pathname}, which is assumed to point to a buffer of at least
|
@var{pathname}, which is assumed to point to a buffer of at least
|
@var{len} bytes, and return a pointer to the buffer. If the current
|
@var{len} bytes, and return a pointer to the buffer. If the current
|
directory's path doesn't fit in @var{len} characters, the result is
|
directory's path doesn't fit in @var{len} characters, the result is
|
@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
|
@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
|
@code{getcwd} will obtain @var{len} bytes of space using
|
@code{getcwd} will obtain @var{len} bytes of space using
|
@code{malloc}.
|
@code{malloc}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c getpagesize.c:5
|
@c getpagesize.c:5
|
@deftypefn Supplemental int getpagesize (void)
|
@deftypefn Supplemental int getpagesize (void)
|
|
|
Returns the number of bytes in a page of memory. This is the
|
Returns the number of bytes in a page of memory. This is the
|
granularity of many of the system memory management routines. No
|
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
|
guarantee is made as to whether or not it is the same as the basic
|
memory management hardware page size.
|
memory management hardware page size.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c getpwd.c:5
|
@c getpwd.c:5
|
@deftypefn Supplemental char* getpwd (void)
|
@deftypefn Supplemental char* getpwd (void)
|
|
|
Returns the current working directory. This implementation caches the
|
Returns the current working directory. This implementation caches the
|
result on the assumption that the process will not call @code{chdir}
|
result on the assumption that the process will not call @code{chdir}
|
between calls to @code{getpwd}.
|
between calls to @code{getpwd}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c gettimeofday.c:12
|
@c gettimeofday.c:12
|
@deftypefn Supplemental int gettimeofday (struct timeval *@var{tp}, void *@var{tz})
|
@deftypefn Supplemental int gettimeofday (struct timeval *@var{tp}, void *@var{tz})
|
|
|
Writes the current time to @var{tp}. This implementation requires
|
Writes the current time to @var{tp}. This implementation requires
|
that @var{tz} be NULL. Returns 0 on success, -1 on failure.
|
that @var{tz} be NULL. Returns 0 on success, -1 on failure.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c hex.c:33
|
@c hex.c:33
|
@deftypefn Extension void hex_init (void)
|
@deftypefn Extension void hex_init (void)
|
|
|
Initializes the array mapping the current character set to
|
Initializes the array mapping the current character set to
|
corresponding hex values. This function must be called before any
|
corresponding hex values. This function must be called before any
|
call to @code{hex_p} or @code{hex_value}. If you fail to call it, a
|
call to @code{hex_p} or @code{hex_value}. If you fail to call it, a
|
default ASCII-based table will normally be used on ASCII systems.
|
default ASCII-based table will normally be used on ASCII systems.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c hex.c:42
|
@c hex.c:42
|
@deftypefn Extension int hex_p (int @var{c})
|
@deftypefn Extension int hex_p (int @var{c})
|
|
|
Evaluates to non-zero if the given character is a valid hex character,
|
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
|
or zero if it is not. Note that the value you pass will be cast to
|
@code{unsigned char} within the macro.
|
@code{unsigned char} within the macro.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c hex.c:50
|
@c hex.c:50
|
@deftypefn Extension {unsigned int} hex_value (int @var{c})
|
@deftypefn Extension {unsigned int} hex_value (int @var{c})
|
|
|
Returns the numeric equivalent of the given character when interpreted
|
Returns the numeric equivalent of the given character when interpreted
|
as a hexadecimal digit. The result is undefined if you pass an
|
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
|
invalid hex digit. Note that the value you pass will be cast to
|
@code{unsigned char} within the macro.
|
@code{unsigned char} within the macro.
|
|
|
The @code{hex_value} macro returns @code{unsigned int}, rather than
|
The @code{hex_value} macro returns @code{unsigned int}, rather than
|
signed @code{int}, to make it easier to use in parsing addresses from
|
signed @code{int}, to make it easier to use in parsing addresses from
|
hex dump files: a signed @code{int} would be sign-extended when
|
hex dump files: a signed @code{int} would be sign-extended when
|
converted to a wider unsigned type --- like @code{bfd_vma}, on some
|
converted to a wider unsigned type --- like @code{bfd_vma}, on some
|
systems.
|
systems.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c index.c:5
|
@c index.c:5
|
@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
|
@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
|
|
|
Returns a pointer to the first occurrence of the character @var{c} in
|
Returns a pointer to the first occurrence of the character @var{c} in
|
the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
|
the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
|
deprecated in new programs in favor of @code{strchr}.
|
deprecated in new programs in favor of @code{strchr}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c insque.c:6
|
@c insque.c:6
|
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
|
|
Routines to manipulate queues built from doubly linked lists. The
|
Routines to manipulate queues built from doubly linked lists. The
|
@code{insque} routine inserts @var{elem} in the queue immediately
|
@code{insque} routine inserts @var{elem} in the queue immediately
|
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
its containing queue. These routines expect to be passed pointers to
|
its containing queue. These routines expect to be passed pointers to
|
structures which have as their first members a forward pointer and a
|
structures which have as their first members a forward pointer and a
|
back pointer, like this prototype (although no prototype is provided):
|
back pointer, like this prototype (although no prototype is provided):
|
|
|
@example
|
@example
|
struct qelem @{
|
struct qelem @{
|
struct qelem *q_forw;
|
struct qelem *q_forw;
|
struct qelem *q_back;
|
struct qelem *q_back;
|
char q_data[];
|
char q_data[];
|
@};
|
@};
|
@end example
|
@end example
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c safe-ctype.c:46
|
@c safe-ctype.c:46
|
@deffn Extension ISALPHA (@var{c})
|
@deffn Extension ISALPHA (@var{c})
|
@deffnx Extension ISALNUM (@var{c})
|
@deffnx Extension ISALNUM (@var{c})
|
@deffnx Extension ISBLANK (@var{c})
|
@deffnx Extension ISBLANK (@var{c})
|
@deffnx Extension ISCNTRL (@var{c})
|
@deffnx Extension ISCNTRL (@var{c})
|
@deffnx Extension ISDIGIT (@var{c})
|
@deffnx Extension ISDIGIT (@var{c})
|
@deffnx Extension ISGRAPH (@var{c})
|
@deffnx Extension ISGRAPH (@var{c})
|
@deffnx Extension ISLOWER (@var{c})
|
@deffnx Extension ISLOWER (@var{c})
|
@deffnx Extension ISPRINT (@var{c})
|
@deffnx Extension ISPRINT (@var{c})
|
@deffnx Extension ISPUNCT (@var{c})
|
@deffnx Extension ISPUNCT (@var{c})
|
@deffnx Extension ISSPACE (@var{c})
|
@deffnx Extension ISSPACE (@var{c})
|
@deffnx Extension ISUPPER (@var{c})
|
@deffnx Extension ISUPPER (@var{c})
|
@deffnx Extension ISXDIGIT (@var{c})
|
@deffnx Extension ISXDIGIT (@var{c})
|
|
|
These twelve macros are defined by @file{safe-ctype.h}. Each has the
|
These twelve macros are defined by @file{safe-ctype.h}. Each has the
|
same meaning as the corresponding macro (with name in lowercase)
|
same meaning as the corresponding macro (with name in lowercase)
|
defined by the standard header @file{ctype.h}. For example,
|
defined by the standard header @file{ctype.h}. For example,
|
@code{ISALPHA} returns true for alphabetic characters and false for
|
@code{ISALPHA} returns true for alphabetic characters and false for
|
others. However, there are two differences between these macros and
|
others. However, there are two differences between these macros and
|
those provided by @file{ctype.h}:
|
those provided by @file{ctype.h}:
|
|
|
@itemize @bullet
|
@itemize @bullet
|
@item These macros are guaranteed to have well-defined behavior for all
|
@item These macros are guaranteed to have well-defined behavior for all
|
values representable by @code{signed char} and @code{unsigned char}, and
|
values representable by @code{signed char} and @code{unsigned char}, and
|
for @code{EOF}.
|
for @code{EOF}.
|
|
|
@item These macros ignore the current locale; they are true for these
|
@item These macros ignore the current locale; they are true for these
|
fixed sets of characters:
|
fixed sets of characters:
|
@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
|
@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
|
@item @code{ALPHA} @tab @kbd{A-Za-z}
|
@item @code{ALPHA} @tab @kbd{A-Za-z}
|
@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
|
@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
|
@item @code{BLANK} @tab @kbd{space tab}
|
@item @code{BLANK} @tab @kbd{space tab}
|
@item @code{CNTRL} @tab @code{!PRINT}
|
@item @code{CNTRL} @tab @code{!PRINT}
|
@item @code{DIGIT} @tab @kbd{0-9}
|
@item @code{DIGIT} @tab @kbd{0-9}
|
@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
|
@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
|
@item @code{LOWER} @tab @kbd{a-z}
|
@item @code{LOWER} @tab @kbd{a-z}
|
@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
|
@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
|
@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
|
@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
|
@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
|
@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
|
@item @code{UPPER} @tab @kbd{A-Z}
|
@item @code{UPPER} @tab @kbd{A-Z}
|
@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
|
@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
|
@end multitable
|
@end multitable
|
|
|
Note that, if the host character set is ASCII or a superset thereof,
|
Note that, if the host character set is ASCII or a superset thereof,
|
all these macros will return false for all values of @code{char} outside
|
all these macros will return false for all values of @code{char} outside
|
the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
|
the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
|
false for characters with numeric values from 128 to 255.
|
false for characters with numeric values from 128 to 255.
|
@end itemize
|
@end itemize
|
@end deffn
|
@end deffn
|
|
|
@c safe-ctype.c:95
|
@c safe-ctype.c:95
|
@deffn Extension ISIDNUM (@var{c})
|
@deffn Extension ISIDNUM (@var{c})
|
@deffnx Extension ISIDST (@var{c})
|
@deffnx Extension ISIDST (@var{c})
|
@deffnx Extension IS_VSPACE (@var{c})
|
@deffnx Extension IS_VSPACE (@var{c})
|
@deffnx Extension IS_NVSPACE (@var{c})
|
@deffnx Extension IS_NVSPACE (@var{c})
|
@deffnx Extension IS_SPACE_OR_NUL (@var{c})
|
@deffnx Extension IS_SPACE_OR_NUL (@var{c})
|
@deffnx Extension IS_ISOBASIC (@var{c})
|
@deffnx Extension IS_ISOBASIC (@var{c})
|
These six macros are defined by @file{safe-ctype.h} and provide
|
These six macros are defined by @file{safe-ctype.h} and provide
|
additional character classes which are useful when doing lexical
|
additional character classes which are useful when doing lexical
|
analysis of C or similar languages. They are true for the following
|
analysis of C or similar languages. They are true for the following
|
sets of characters:
|
sets of characters:
|
|
|
@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
|
@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
|
@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
|
@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
|
@item @code{IDST} @tab @kbd{A-Za-z_}
|
@item @code{IDST} @tab @kbd{A-Za-z_}
|
@item @code{VSPACE} @tab @kbd{\r \n}
|
@item @code{VSPACE} @tab @kbd{\r \n}
|
@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
|
@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
|
@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
|
@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
|
@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
|
@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
|
@end multitable
|
@end multitable
|
@end deffn
|
@end deffn
|
|
|
@c lbasename.c:23
|
@c lbasename.c:23
|
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
|
|
Given a pointer to a string containing a typical pathname
|
Given a pointer to a string containing a typical pathname
|
(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
|
(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
|
last component of the pathname (@samp{ls.c} in this case). The
|
last component of the pathname (@samp{ls.c} in this case). The
|
returned pointer is guaranteed to lie within the original
|
returned pointer is guaranteed to lie within the original
|
string. This latter fact is not true of many vendor C
|
string. This latter fact is not true of many vendor C
|
libraries, which return special strings or modify the passed
|
libraries, which return special strings or modify the passed
|
strings for particular input.
|
strings for particular input.
|
|
|
In particular, the empty string returns the same empty string,
|
In particular, the empty string returns the same empty string,
|
and a path ending in @code{/} returns the empty string after it.
|
and a path ending in @code{/} returns the empty string after it.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c lrealpath.c:25
|
@c lrealpath.c:25
|
@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
|
@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
|
|
|
Given a pointer to a string containing a pathname, returns a canonical
|
Given a pointer to a string containing a pathname, returns a canonical
|
version of the filename. Symlinks will be resolved, and ``.'' and ``..''
|
version of the filename. Symlinks will be resolved, and ``.'' and ``..''
|
components will be simplified. The returned value will be allocated using
|
components will be simplified. The returned value will be allocated using
|
@code{malloc}, or @code{NULL} will be returned on a memory allocation error.
|
@code{malloc}, or @code{NULL} will be returned on a memory allocation error.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c make-relative-prefix.c:24
|
@c make-relative-prefix.c:24
|
@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
|
@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
|
|
|
Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
|
Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
|
return the path that is in the same position relative to
|
return the path that is in the same position relative to
|
@var{progname}'s directory as @var{prefix} is relative to
|
@var{progname}'s directory as @var{prefix} is relative to
|
@var{bin_prefix}. That is, a string starting with the directory
|
@var{bin_prefix}. That is, a string starting with the directory
|
portion of @var{progname}, followed by a relative pathname of the
|
portion of @var{progname}, followed by a relative pathname of the
|
difference between @var{bin_prefix} and @var{prefix}.
|
difference between @var{bin_prefix} and @var{prefix}.
|
|
|
If @var{progname} does not contain any directory separators,
|
If @var{progname} does not contain any directory separators,
|
@code{make_relative_prefix} will search @env{PATH} to find a program
|
@code{make_relative_prefix} will search @env{PATH} to find a program
|
named @var{progname}. Also, if @var{progname} is a symbolic link,
|
named @var{progname}. Also, if @var{progname} is a symbolic link,
|
the symbolic link will be resolved.
|
the symbolic link will be resolved.
|
|
|
For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
|
For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
|
@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
|
@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
|
@code{/red/green/blue/gcc}, then this function will return
|
@code{/red/green/blue/gcc}, then this function will return
|
@code{/red/green/blue/../../omega/}.
|
@code{/red/green/blue/../../omega/}.
|
|
|
The return value is normally allocated via @code{malloc}. If no
|
The return value is normally allocated via @code{malloc}. If no
|
relative prefix can be found, return @code{NULL}.
|
relative prefix can be found, return @code{NULL}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c make-temp-file.c:168
|
@c make-temp-file.c:168
|
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
|
|
Return a temporary file name (as a string) or @code{NULL} if unable to
|
Return a temporary file name (as a string) or @code{NULL} if unable to
|
create one. @var{suffix} is a suffix to append to the file name. The
|
create one. @var{suffix} is a suffix to append to the file name. The
|
string is @code{malloc}ed, and the temporary file has been created.
|
string is @code{malloc}ed, and the temporary file has been created.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memchr.c:3
|
@c memchr.c:3
|
@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
|
@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
|
|
|
This function searches memory starting at @code{*@var{s}} for the
|
This function searches memory starting at @code{*@var{s}} for the
|
character @var{c}. The search only ends with the first occurrence of
|
character @var{c}. The search only ends with the first occurrence of
|
@var{c}, or after @var{length} characters; in particular, a null
|
@var{c}, or after @var{length} characters; in particular, a null
|
character does not terminate the search. If the character @var{c} is
|
character does not terminate the search. If the character @var{c} is
|
found within @var{length} characters of @code{*@var{s}}, a pointer
|
found within @var{length} characters of @code{*@var{s}}, a pointer
|
to the character is returned. If @var{c} is not found, then @code{NULL} is
|
to the character is returned. If @var{c} is not found, then @code{NULL} is
|
returned.
|
returned.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memcmp.c:6
|
@c memcmp.c:6
|
@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
|
@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
|
|
|
Compares the first @var{count} bytes of two areas of memory. Returns
|
Compares the first @var{count} bytes of two areas of memory. Returns
|
zero if they are the same, a value less than zero if @var{x} is
|
zero if they are the same, a value less than zero if @var{x} is
|
lexically less than @var{y}, or a value greater than zero if @var{x}
|
lexically less than @var{y}, or a value greater than zero if @var{x}
|
is lexically greater than @var{y}. Note that lexical order is determined
|
is lexically greater than @var{y}. Note that lexical order is determined
|
as if comparing unsigned char arrays.
|
as if comparing unsigned char arrays.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memcpy.c:6
|
@c memcpy.c:6
|
@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
|
|
Copies @var{length} bytes from memory region @var{in} to region
|
Copies @var{length} bytes from memory region @var{in} to region
|
@var{out}. Returns a pointer to @var{out}.
|
@var{out}. Returns a pointer to @var{out}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memmem.c:20
|
@c memmem.c:20
|
@deftypefn Supplemental void* memmem (const void *@var{haystack}, size_t @var{haystack_len} const void *@var{needle}, size_t @var{needle_len})
|
@deftypefn Supplemental void* memmem (const void *@var{haystack}, size_t @var{haystack_len} const void *@var{needle}, size_t @var{needle_len})
|
|
|
Returns a pointer to the first occurrence of @var{needle} (length
|
Returns a pointer to the first occurrence of @var{needle} (length
|
@var{needle_len}) in @var{haystack} (length @var{haystack_len}).
|
@var{needle_len}) in @var{haystack} (length @var{haystack_len}).
|
Returns @code{NULL} if not found.
|
Returns @code{NULL} if not found.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memmove.c:6
|
@c memmove.c:6
|
@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
|
@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
|
|
|
Copies @var{count} bytes from memory area @var{from} to memory area
|
Copies @var{count} bytes from memory area @var{from} to memory area
|
@var{to}, returning a pointer to @var{to}.
|
@var{to}, returning a pointer to @var{to}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c mempcpy.c:23
|
@c mempcpy.c:23
|
@deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
@deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
|
|
Copies @var{length} bytes from memory region @var{in} to region
|
Copies @var{length} bytes from memory region @var{in} to region
|
@var{out}. Returns a pointer to @var{out} + @var{length}.
|
@var{out}. Returns a pointer to @var{out} + @var{length}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c memset.c:6
|
@c memset.c:6
|
@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
|
@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
|
|
|
Sets the first @var{count} bytes of @var{s} to the constant byte
|
Sets the first @var{count} bytes of @var{s} to the constant byte
|
@var{c}, returning a pointer to @var{s}.
|
@var{c}, returning a pointer to @var{s}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c mkstemps.c:58
|
@c mkstemps.c:58
|
@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len})
|
@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len})
|
|
|
Generate a unique temporary file name from @var{pattern}.
|
Generate a unique temporary file name from @var{pattern}.
|
@var{pattern} has the form:
|
@var{pattern} has the form:
|
|
|
@example
|
@example
|
@var{path}/ccXXXXXX@var{suffix}
|
@var{path}/ccXXXXXX@var{suffix}
|
@end example
|
@end example
|
|
|
@var{suffix_len} tells us how long @var{suffix} is (it can be zero
|
@var{suffix_len} tells us how long @var{suffix} is (it can be zero
|
length). The last six characters of @var{pattern} before @var{suffix}
|
length). The last six characters of @var{pattern} before @var{suffix}
|
must be @samp{XXXXXX}; they are replaced with a string that makes the
|
must be @samp{XXXXXX}; they are replaced with a string that makes the
|
filename unique. Returns a file descriptor open on the file for
|
filename unique. Returns a file descriptor open on the file for
|
reading and writing.
|
reading and writing.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:266
|
@c pexecute.txh:266
|
@deftypefn Extension void pex_free (struct pex_obj @var{obj})
|
@deftypefn Extension void pex_free (struct pex_obj @var{obj})
|
|
|
Clean up and free all data associated with @var{obj}. If you have not
|
Clean up and free all data associated with @var{obj}. If you have not
|
yet called @code{pex_get_times} or @code{pex_get_status}, this will
|
yet called @code{pex_get_times} or @code{pex_get_status}, this will
|
try to kill the subprocesses.
|
try to kill the subprocesses.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:241
|
@c pexecute.txh:241
|
@deftypefn Extension int pex_get_status (struct pex_obj *@var{obj}, int @var{count}, int *@var{vector})
|
@deftypefn Extension int pex_get_status (struct pex_obj *@var{obj}, int @var{count}, int *@var{vector})
|
|
|
Returns the exit status of all programs run using @var{obj}.
|
Returns the exit status of all programs run using @var{obj}.
|
@var{count} is the number of results expected. The results will be
|
@var{count} is the number of results expected. The results will be
|
placed into @var{vector}. The results are in the order of the calls
|
placed into @var{vector}. The results are in the order of the calls
|
to @code{pex_run}. Returns 0 on error, 1 on success.
|
to @code{pex_run}. Returns 0 on error, 1 on success.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:250
|
@c pexecute.txh:250
|
@deftypefn Extension int pex_get_times (struct pex_obj *@var{obj}, int @var{count}, struct pex_time *@var{vector})
|
@deftypefn Extension int pex_get_times (struct pex_obj *@var{obj}, int @var{count}, struct pex_time *@var{vector})
|
|
|
Returns the process execution times of all programs run using
|
Returns the process execution times of all programs run using
|
@var{obj}. @var{count} is the number of results expected. The
|
@var{obj}. @var{count} is the number of results expected. The
|
results will be placed into @var{vector}. The results are in the
|
results will be placed into @var{vector}. The results are in the
|
order of the calls to @code{pex_run}. Returns 0 on error, 1 on
|
order of the calls to @code{pex_run}. Returns 0 on error, 1 on
|
success.
|
success.
|
|
|
@code{struct pex_time} has the following fields of the type
|
@code{struct pex_time} has the following fields of the type
|
@code{unsigned long}: @code{user_seconds},
|
@code{unsigned long}: @code{user_seconds},
|
@code{user_microseconds}, @code{system_seconds},
|
@code{user_microseconds}, @code{system_seconds},
|
@code{system_microseconds}. On systems which do not support reporting
|
@code{system_microseconds}. On systems which do not support reporting
|
process times, all the fields will be set to @code{0}.
|
process times, all the fields will be set to @code{0}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:2
|
@c pexecute.txh:2
|
@deftypefn Extension {struct pex_obj *} pex_init (int @var{flags}, const char *@var{pname}, const char *@var{tempbase})
|
@deftypefn Extension {struct pex_obj *} pex_init (int @var{flags}, const char *@var{pname}, const char *@var{tempbase})
|
|
|
Prepare to execute one or more programs, with standard output of each
|
Prepare to execute one or more programs, with standard output of each
|
program fed to standard input of the next. This is a system
|
program fed to standard input of the next. This is a system
|
independent interface to execute a pipeline.
|
independent interface to execute a pipeline.
|
|
|
@var{flags} is a bitwise combination of the following:
|
@var{flags} is a bitwise combination of the following:
|
|
|
@table @code
|
@table @code
|
|
|
@vindex PEX_RECORD_TIMES
|
@vindex PEX_RECORD_TIMES
|
@item PEX_RECORD_TIMES
|
@item PEX_RECORD_TIMES
|
Record subprocess times if possible.
|
Record subprocess times if possible.
|
|
|
@vindex PEX_USE_PIPES
|
@vindex PEX_USE_PIPES
|
@item PEX_USE_PIPES
|
@item PEX_USE_PIPES
|
Use pipes for communication between processes, if possible.
|
Use pipes for communication between processes, if possible.
|
|
|
@vindex PEX_SAVE_TEMPS
|
@vindex PEX_SAVE_TEMPS
|
@item PEX_SAVE_TEMPS
|
@item PEX_SAVE_TEMPS
|
Don't delete temporary files used for communication between
|
Don't delete temporary files used for communication between
|
processes.
|
processes.
|
|
|
@end table
|
@end table
|
|
|
@var{pname} is the name of program to be executed, used in error
|
@var{pname} is the name of program to be executed, used in error
|
messages. @var{tempbase} is a base name to use for any required
|
messages. @var{tempbase} is a base name to use for any required
|
temporary files; it may be @code{NULL} to use a randomly chosen name.
|
temporary files; it may be @code{NULL} to use a randomly chosen name.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:155
|
@c pexecute.txh:155
|
@deftypefn Extension {FILE *} pex_input_file (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{in_name})
|
@deftypefn Extension {FILE *} pex_input_file (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{in_name})
|
|
|
Return a stream for a temporary file to pass to the first program in
|
Return a stream for a temporary file to pass to the first program in
|
the pipeline as input.
|
the pipeline as input.
|
|
|
The name of the input file is chosen according to the same rules
|
The name of the input file is chosen according to the same rules
|
@code{pex_run} uses to choose output file names, based on
|
@code{pex_run} uses to choose output file names, based on
|
@var{in_name}, @var{obj} and the @code{PEX_SUFFIX} bit in @var{flags}.
|
@var{in_name}, @var{obj} and the @code{PEX_SUFFIX} bit in @var{flags}.
|
|
|
Don't call @code{fclose} on the returned stream; the first call to
|
Don't call @code{fclose} on the returned stream; the first call to
|
@code{pex_run} closes it automatically.
|
@code{pex_run} closes it automatically.
|
|
|
If @var{flags} includes @code{PEX_BINARY_OUTPUT}, open the stream in
|
If @var{flags} includes @code{PEX_BINARY_OUTPUT}, open the stream in
|
binary mode; otherwise, open it in the default mode. Including
|
binary mode; otherwise, open it in the default mode. Including
|
@code{PEX_BINARY_OUTPUT} in @var{flags} has no effect on Unix.
|
@code{PEX_BINARY_OUTPUT} in @var{flags} has no effect on Unix.
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:172
|
@c pexecute.txh:172
|
@deftypefn Extension {FILE *} pex_input_pipe (struct pex_obj *@var{obj}, int @var{binary})
|
@deftypefn Extension {FILE *} pex_input_pipe (struct pex_obj *@var{obj}, int @var{binary})
|
|
|
Return a stream @var{fp} for a pipe connected to the standard input of
|
Return a stream @var{fp} for a pipe connected to the standard input of
|
the first program in the pipeline; @var{fp} is opened for writing.
|
the first program in the pipeline; @var{fp} is opened for writing.
|
You must have passed @code{PEX_USE_PIPES} to the @code{pex_init} call
|
You must have passed @code{PEX_USE_PIPES} to the @code{pex_init} call
|
that returned @var{obj}.
|
that returned @var{obj}.
|
|
|
You must close @var{fp} using @code{fclose} yourself when you have
|
You must close @var{fp} using @code{fclose} yourself when you have
|
finished writing data to the pipeline.
|
finished writing data to the pipeline.
|
|
|
The file descriptor underlying @var{fp} is marked not to be inherited
|
The file descriptor underlying @var{fp} is marked not to be inherited
|
by child processes.
|
by child processes.
|
|
|
On systems that do not support pipes, this function returns
|
On systems that do not support pipes, this function returns
|
@code{NULL}, and sets @code{errno} to @code{EINVAL}. If you would
|
@code{NULL}, and sets @code{errno} to @code{EINVAL}. If you would
|
like to write code that is portable to all systems the @code{pex}
|
like to write code that is portable to all systems the @code{pex}
|
functions support, consider using @code{pex_input_file} instead.
|
functions support, consider using @code{pex_input_file} instead.
|
|
|
There are two opportunities for deadlock using
|
There are two opportunities for deadlock using
|
@code{pex_input_pipe}:
|
@code{pex_input_pipe}:
|
|
|
@itemize @bullet
|
@itemize @bullet
|
@item
|
@item
|
Most systems' pipes can buffer only a fixed amount of data; a process
|
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 @file{fp}
|
that writes to a full pipe blocks. Thus, if you write to @file{fp}
|
before starting the first process, you run the risk of blocking when
|
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
|
there is no child process yet to read the data and allow you to
|
continue. @code{pex_input_pipe} makes no promises about the
|
continue. @code{pex_input_pipe} makes no promises about the
|
size of the pipe's buffer, so if you need to write any data at all
|
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
|
before starting the first process in the pipeline, consider using
|
@code{pex_input_file} instead.
|
@code{pex_input_file} instead.
|
|
|
@item
|
@item
|
Using @code{pex_input_pipe} and @code{pex_read_output} together
|
Using @code{pex_input_pipe} and @code{pex_read_output} together
|
may also cause deadlock. If the output pipe fills up, so that each
|
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
|
program in the pipeline is waiting for the next to read more data, and
|
you fill the input pipe by writing more data to @var{fp}, then there
|
you fill the input pipe by writing more data to @var{fp}, then there
|
is no way to make progress: the only process that could read data from
|
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.
|
the output pipe is you, but you are blocked on the input pipe.
|
|
|
@end itemize
|
@end itemize
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:274
|
@c pexecute.txh:274
|
@deftypefn Extension {const char *} pex_one (int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{pname}, const char *@var{outname}, const char *@var{errname}, int *@var{status}, int *@var{err})
|
@deftypefn Extension {const char *} pex_one (int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{pname}, const char *@var{outname}, const char *@var{errname}, int *@var{status}, int *@var{err})
|
|
|
An interface to permit the easy execution of a
|
An interface to permit the easy execution of a
|
single program. The return value and most of the parameters are as
|
single program. The return value and most of the parameters are as
|
for a call to @code{pex_run}. @var{flags} is restricted to a
|
for a call to @code{pex_run}. @var{flags} is restricted to a
|
combination of @code{PEX_SEARCH}, @code{PEX_STDERR_TO_STDOUT}, and
|
combination of @code{PEX_SEARCH}, @code{PEX_STDERR_TO_STDOUT}, and
|
@code{PEX_BINARY_OUTPUT}. @var{outname} is interpreted as if
|
@code{PEX_BINARY_OUTPUT}. @var{outname} is interpreted as if
|
@code{PEX_LAST} were set. On a successful return, @code{*@var{status}} will
|
@code{PEX_LAST} were set. On a successful return, @code{*@var{status}} will
|
be set to the exit status of the program.
|
be set to the exit status of the program.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:228
|
@c pexecute.txh:228
|
@deftypefn Extension {FILE *} pex_read_err (struct pex_obj *@var{obj}, int @var{binary})
|
@deftypefn Extension {FILE *} pex_read_err (struct pex_obj *@var{obj}, int @var{binary})
|
|
|
Returns a @code{FILE} pointer which may be used to read the standard
|
Returns a @code{FILE} pointer which may be used to read the standard
|
error of the last program in the pipeline. When this is used,
|
error of the last program in the pipeline. When this is used,
|
@code{PEX_LAST} should not be used in a call to @code{pex_run}. After
|
@code{PEX_LAST} should not be used in a call to @code{pex_run}. After
|
this is called, @code{pex_run} may no longer be called with the same
|
this is called, @code{pex_run} may no longer be called with the same
|
@var{obj}. @var{binary} should be non-zero if the file should be
|
@var{obj}. @var{binary} should be non-zero if the file should be
|
opened in binary mode. Don't call @code{fclose} on the returned file;
|
opened in binary mode. Don't call @code{fclose} on the returned file;
|
it will be closed by @code{pex_free}.
|
it will be closed by @code{pex_free}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:216
|
@c pexecute.txh:216
|
@deftypefn Extension {FILE *} pex_read_output (struct pex_obj *@var{obj}, int @var{binary})
|
@deftypefn Extension {FILE *} pex_read_output (struct pex_obj *@var{obj}, int @var{binary})
|
|
|
Returns a @code{FILE} pointer which may be used to read the standard
|
Returns a @code{FILE} pointer which may be used to read the standard
|
output of the last program in the pipeline. When this is used,
|
output of the last program in the pipeline. When this is used,
|
@code{PEX_LAST} should not be used in a call to @code{pex_run}. After
|
@code{PEX_LAST} should not be used in a call to @code{pex_run}. After
|
this is called, @code{pex_run} may no longer be called with the same
|
this is called, @code{pex_run} may no longer be called with the same
|
@var{obj}. @var{binary} should be non-zero if the file should be
|
@var{obj}. @var{binary} should be non-zero if the file should be
|
opened in binary mode. Don't call @code{fclose} on the returned file;
|
opened in binary mode. Don't call @code{fclose} on the returned file;
|
it will be closed by @code{pex_free}.
|
it will be closed by @code{pex_free}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:33
|
@c pexecute.txh:33
|
@deftypefn Extension {const char *} pex_run (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{outname}, const char *@var{errname}, int *@var{err})
|
@deftypefn Extension {const char *} pex_run (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{outname}, const char *@var{errname}, int *@var{err})
|
|
|
Execute one program in a pipeline. On success this returns
|
Execute one program in a pipeline. On success this returns
|
@code{NULL}. On failure it returns an error message, a statically
|
@code{NULL}. On failure it returns an error message, a statically
|
allocated string.
|
allocated string.
|
|
|
@var{obj} is returned by a previous call to @code{pex_init}.
|
@var{obj} is returned by a previous call to @code{pex_init}.
|
|
|
@var{flags} is a bitwise combination of the following:
|
@var{flags} is a bitwise combination of the following:
|
|
|
@table @code
|
@table @code
|
|
|
@vindex PEX_LAST
|
@vindex PEX_LAST
|
@item PEX_LAST
|
@item PEX_LAST
|
This must be set on the last program in the pipeline. In particular,
|
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
|
it should be set when executing a single program. The standard output
|
of the program will be sent to @var{outname}, or, if @var{outname} is
|
of the program will be sent to @var{outname}, or, if @var{outname} is
|
@code{NULL}, to the standard output of the calling program. Do @emph{not}
|
@code{NULL}, to the standard output of the calling program. Do @emph{not}
|
set this bit if you want to call @code{pex_read_output}
|
set this bit if you want to call @code{pex_read_output}
|
(described below). After a call to @code{pex_run} with this bit set,
|
(described below). After a call to @code{pex_run} with this bit set,
|
@var{pex_run} may no longer be called with the same @var{obj}.
|
@var{pex_run} may no longer be called with the same @var{obj}.
|
|
|
@vindex PEX_SEARCH
|
@vindex PEX_SEARCH
|
@item PEX_SEARCH
|
@item PEX_SEARCH
|
Search for the program using the user's executable search path.
|
Search for the program using the user's executable search path.
|
|
|
@vindex PEX_SUFFIX
|
@vindex PEX_SUFFIX
|
@item PEX_SUFFIX
|
@item PEX_SUFFIX
|
@var{outname} is a suffix. See the description of @var{outname},
|
@var{outname} is a suffix. See the description of @var{outname},
|
below.
|
below.
|
|
|
@vindex PEX_STDERR_TO_STDOUT
|
@vindex PEX_STDERR_TO_STDOUT
|
@item PEX_STDERR_TO_STDOUT
|
@item PEX_STDERR_TO_STDOUT
|
Send the program's standard error to standard output, if possible.
|
Send the program's standard error to standard output, if possible.
|
|
|
@vindex PEX_BINARY_INPUT
|
@vindex PEX_BINARY_INPUT
|
@vindex PEX_BINARY_OUTPUT
|
@vindex PEX_BINARY_OUTPUT
|
@vindex PEX_BINARY_ERROR
|
@vindex PEX_BINARY_ERROR
|
@item PEX_BINARY_INPUT
|
@item PEX_BINARY_INPUT
|
@itemx PEX_BINARY_OUTPUT
|
@itemx PEX_BINARY_OUTPUT
|
@itemx PEX_BINARY_ERROR
|
@itemx PEX_BINARY_ERROR
|
The standard input (output or error) of the program should be read (written) in
|
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
|
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
|
which do not distinguish binary mode and text mode, such as Unix. For
|
proper behavior these flags should match appropriately---a call to
|
proper behavior these flags should match appropriately---a call to
|
@code{pex_run} using @code{PEX_BINARY_OUTPUT} should be followed by a
|
@code{pex_run} using @code{PEX_BINARY_OUTPUT} should be followed by a
|
call using @code{PEX_BINARY_INPUT}.
|
call using @code{PEX_BINARY_INPUT}.
|
|
|
@vindex PEX_STDERR_TO_PIPE
|
@vindex PEX_STDERR_TO_PIPE
|
@item PEX_STDERR_TO_PIPE
|
@item PEX_STDERR_TO_PIPE
|
Send the program's standard error to a pipe, if possible. This flag
|
Send the program's standard error to a pipe, if possible. This flag
|
cannot be specified together with @code{PEX_STDERR_TO_STDOUT}. This
|
cannot be specified together with @code{PEX_STDERR_TO_STDOUT}. This
|
flag can be specified only on the last program in pipeline.
|
flag can be specified only on the last program in pipeline.
|
|
|
@end table
|
@end table
|
|
|
@var{executable} is the program to execute. @var{argv} is the set of
|
@var{executable} is the program to execute. @var{argv} is the set of
|
arguments to pass to the program; normally @code{@var{argv}[0]} will
|
arguments to pass to the program; normally @code{@var{argv}[0]} will
|
be a copy of @var{executable}.
|
be a copy of @var{executable}.
|
|
|
@var{outname} is used to set the name of the file to use for standard
|
@var{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:
|
output. There are two cases in which no output file will be used:
|
|
|
@enumerate
|
@enumerate
|
@item
|
@item
|
if @code{PEX_LAST} is not set in @var{flags}, and @code{PEX_USE_PIPES}
|
if @code{PEX_LAST} is not set in @var{flags}, and @code{PEX_USE_PIPES}
|
was set in the call to @code{pex_init}, and the system supports pipes
|
was set in the call to @code{pex_init}, and the system supports pipes
|
|
|
@item
|
@item
|
if @code{PEX_LAST} is set in @var{flags}, and @var{outname} is
|
if @code{PEX_LAST} is set in @var{flags}, and @var{outname} is
|
@code{NULL}
|
@code{NULL}
|
@end enumerate
|
@end enumerate
|
|
|
@noindent
|
@noindent
|
Otherwise the code will use a file to hold standard
|
Otherwise the code will use a file to hold standard
|
output. If @code{PEX_LAST} is not set, this file is considered to be
|
output. If @code{PEX_LAST} is not set, this file is considered to be
|
a temporary file, and it will be removed when no longer needed, unless
|
a temporary file, and it will be removed when no longer needed, unless
|
@code{PEX_SAVE_TEMPS} was set in the call to @code{pex_init}.
|
@code{PEX_SAVE_TEMPS} was set in the call to @code{pex_init}.
|
|
|
There are two cases to consider when setting the name of the file to
|
There are two cases to consider when setting the name of the file to
|
hold standard output.
|
hold standard output.
|
|
|
@enumerate
|
@enumerate
|
@item
|
@item
|
@code{PEX_SUFFIX} is set in @var{flags}. In this case
|
@code{PEX_SUFFIX} is set in @var{flags}. In this case
|
@var{outname} may not be @code{NULL}. If the @var{tempbase} parameter
|
@var{outname} may not be @code{NULL}. If the @var{tempbase} parameter
|
to @code{pex_init} was not @code{NULL}, then the output file name is
|
to @code{pex_init} was not @code{NULL}, then the output file name is
|
the concatenation of @var{tempbase} and @var{outname}. If
|
the concatenation of @var{tempbase} and @var{outname}. If
|
@var{tempbase} was @code{NULL}, then the output file name is a random
|
@var{tempbase} was @code{NULL}, then the output file name is a random
|
file name ending in @var{outname}.
|
file name ending in @var{outname}.
|
|
|
@item
|
@item
|
@code{PEX_SUFFIX} was not set in @var{flags}. In this
|
@code{PEX_SUFFIX} was not set in @var{flags}. In this
|
case, if @var{outname} is not @code{NULL}, it is used as the output
|
case, if @var{outname} is not @code{NULL}, it is used as the output
|
file name. If @var{outname} is @code{NULL}, and @var{tempbase} was
|
file name. If @var{outname} is @code{NULL}, and @var{tempbase} was
|
not NULL, the output file name is randomly chosen using
|
not NULL, the output file name is randomly chosen using
|
@var{tempbase}. Otherwise the output file name is chosen completely
|
@var{tempbase}. Otherwise the output file name is chosen completely
|
at random.
|
at random.
|
@end enumerate
|
@end enumerate
|
|
|
@var{errname} is the file name to use for standard error output. If
|
@var{errname} is the file name to use for standard error output. If
|
it is @code{NULL}, standard error is the same as the caller's.
|
it is @code{NULL}, standard error is the same as the caller's.
|
Otherwise, standard error is written to the named file.
|
Otherwise, standard error is written to the named file.
|
|
|
On an error return, the code sets @code{*@var{err}} to an @code{errno}
|
On an error return, the code sets @code{*@var{err}} to an @code{errno}
|
value, or to 0 if there is no relevant @code{errno}.
|
value, or to 0 if there is no relevant @code{errno}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:142
|
@c pexecute.txh:142
|
@deftypefn Extension {const char *} pex_run_in_environment (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, char * const *@var{env}, int @var{env_size}, const char *@var{outname}, const char *@var{errname}, int *@var{err})
|
@deftypefn Extension {const char *} pex_run_in_environment (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, char * const *@var{env}, int @var{env_size}, const char *@var{outname}, const char *@var{errname}, int *@var{err})
|
|
|
Execute one program in a pipeline, permitting the environment for the
|
Execute one program in a pipeline, permitting the environment for the
|
program to be specified. Behaviour and parameters not listed below are
|
program to be specified. Behaviour and parameters not listed below are
|
as for @code{pex_run}.
|
as for @code{pex_run}.
|
|
|
@var{env} is the environment for the child process, specified as an array of
|
@var{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
|
character pointers. Each element of the array should point to a string of the
|
form @code{VAR=VALUE}, with the exception of the last element that must be
|
form @code{VAR=VALUE}, with the exception of the last element that must be
|
@code{NULL}.
|
@code{NULL}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:286
|
@c pexecute.txh:286
|
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int @var{flags})
|
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int @var{flags})
|
|
|
This is the old interface to execute one or more programs. It is
|
This is the old interface to execute one or more programs. It is
|
still supported for compatibility purposes, but is no longer
|
still supported for compatibility purposes, but is no longer
|
documented.
|
documented.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strsignal.c:541
|
@c strsignal.c:541
|
@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message})
|
@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message})
|
|
|
Print @var{message} to the standard error, followed by a colon,
|
Print @var{message} to the standard error, followed by a colon,
|
followed by the description of the signal specified by @var{signo},
|
followed by the description of the signal specified by @var{signo},
|
followed by a newline.
|
followed by a newline.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c putenv.c:21
|
@c putenv.c:21
|
@deftypefn Supplemental int putenv (const char *@var{string})
|
@deftypefn Supplemental int putenv (const char *@var{string})
|
|
|
Uses @code{setenv} or @code{unsetenv} to put @var{string} into
|
Uses @code{setenv} or @code{unsetenv} to put @var{string} into
|
the environment or remove it. If @var{string} is of the form
|
the environment or remove it. If @var{string} is of the form
|
@samp{name=value} the string is added; if no @samp{=} is present the
|
@samp{name=value} the string is added; if no @samp{=} is present the
|
name is unset/removed.
|
name is unset/removed.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c pexecute.txh:294
|
@c pexecute.txh:294
|
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
|
|
Another part of the old execution interface.
|
Another part of the old execution interface.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c random.c:39
|
@c random.c:39
|
@deftypefn Supplement {long int} random (void)
|
@deftypefn Supplement {long int} random (void)
|
@deftypefnx Supplement void srandom (unsigned int @var{seed})
|
@deftypefnx Supplement void srandom (unsigned int @var{seed})
|
@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
|
@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
|
@deftypefnx Supplement void* setstate (void *@var{arg_state})
|
@deftypefnx Supplement void* setstate (void *@var{arg_state})
|
|
|
Random number functions. @code{random} returns a random number in the
|
Random number functions. @code{random} returns a random number in the
|
range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
|
range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
|
number generator to some starting point determined by @var{seed}
|
number generator to some starting point determined by @var{seed}
|
(else, the values returned by @code{random} are always the same for each
|
(else, the values returned by @code{random} are always the same for each
|
run of the program). @code{initstate} and @code{setstate} allow fine-grained
|
run of the program). @code{initstate} and @code{setstate} allow fine-grained
|
control over the state of the random number generator.
|
control over the state of the random number generator.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c concat.c:173
|
@c concat.c:173
|
@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
|
@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
|
|
|
Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
|
Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
|
is freed after the string is created. This is intended to be useful
|
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
|
when you're extending an existing string or building up a string in a
|
loop:
|
loop:
|
|
|
@example
|
@example
|
str = reconcat (str, "pre-", str, NULL);
|
str = reconcat (str, "pre-", str, NULL);
|
@end example
|
@end example
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c rename.c:6
|
@c rename.c:6
|
@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
|
@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
|
|
|
Renames a file from @var{old} to @var{new}. If @var{new} already
|
Renames a file from @var{old} to @var{new}. If @var{new} already
|
exists, it is removed.
|
exists, it is removed.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c rindex.c:5
|
@c rindex.c:5
|
@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
|
@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
|
|
|
Returns a pointer to the last occurrence of the character @var{c} in
|
Returns a pointer to the last occurrence of the character @var{c} in
|
the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
|
the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
|
deprecated in new programs in favor of @code{strrchr}.
|
deprecated in new programs in favor of @code{strrchr}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c setenv.c:22
|
@c setenv.c:22
|
@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
|
@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
|
@deftypefnx Supplemental void unsetenv (const char *@var{name})
|
@deftypefnx Supplemental void unsetenv (const char *@var{name})
|
|
|
@code{setenv} adds @var{name} to the environment with value
|
@code{setenv} adds @var{name} to the environment with value
|
@var{value}. If the name was already present in the environment,
|
@var{value}. If the name was already present in the environment,
|
the new value will be stored only if @var{overwrite} is nonzero.
|
the new value will be stored only if @var{overwrite} is nonzero.
|
The companion @code{unsetenv} function removes @var{name} from the
|
The companion @code{unsetenv} function removes @var{name} from the
|
environment. This implementation is not safe for multithreaded code.
|
environment. This implementation is not safe for multithreaded code.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strsignal.c:348
|
@c strsignal.c:348
|
@deftypefn Extension int signo_max (void)
|
@deftypefn Extension int signo_max (void)
|
|
|
Returns the maximum signal value for which a corresponding symbolic
|
Returns the maximum signal value for which a corresponding symbolic
|
name or message is available. Note that in the case where we use the
|
name or message is available. Note that in the case where we use the
|
@code{sys_siglist} supplied by the system, it is possible for there to
|
@code{sys_siglist} supplied by the system, it is possible for there to
|
be more symbolic names than messages, or vice versa. In fact, the
|
be more symbolic names than messages, or vice versa. In fact, the
|
manual page for @code{psignal(3b)} explicitly warns that one should
|
manual page for @code{psignal(3b)} explicitly warns that one should
|
check the size of the table (@code{NSIG}) before indexing it, since
|
check the size of the table (@code{NSIG}) before indexing it, since
|
new signal codes may be added to the system before they are added to
|
new signal codes may be added to the system before they are added to
|
the table. Thus @code{NSIG} might be smaller than value implied by
|
the table. Thus @code{NSIG} might be smaller than value implied by
|
the largest signo value defined in @code{<signal.h>}.
|
the largest signo value defined in @code{<signal.h>}.
|
|
|
We return the maximum value that can be used to obtain a meaningful
|
We return the maximum value that can be used to obtain a meaningful
|
symbolic name or message.
|
symbolic name or message.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c sigsetmask.c:8
|
@c sigsetmask.c:8
|
@deftypefn Supplemental int sigsetmask (int @var{set})
|
@deftypefn Supplemental int sigsetmask (int @var{set})
|
|
|
Sets the signal mask to the one provided in @var{set} and returns
|
Sets the signal mask to the one provided in @var{set} and returns
|
the old mask (which, for libiberty's implementation, will always
|
the old mask (which, for libiberty's implementation, will always
|
be the value @code{1}).
|
be the value @code{1}).
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c snprintf.c:28
|
@c snprintf.c:28
|
@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...)
|
@deftypefn Supplemental int snprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, ...)
|
|
|
This function is similar to @code{sprintf}, but it will write to
|
This function is similar to @code{sprintf}, but it will write to
|
@var{buf} at most @code{@var{n}-1} bytes of text, followed by a
|
@var{buf} at most @code{@var{n}-1} bytes of text, followed by a
|
terminating null byte, for a total of @var{n} bytes.
|
terminating null byte, for a total of @var{n} bytes.
|
On error the return value is -1, otherwise it returns the number of
|
On error the return value is -1, otherwise it returns the number of
|
bytes, not including the terminating null byte, that would have been
|
bytes, not including the terminating null byte, that would have been
|
written had @var{n} been sufficiently large, regardless of the actual
|
written had @var{n} been sufficiently large, regardless of the actual
|
value of @var{n}. Note some pre-C99 system libraries do not implement
|
value of @var{n}. Note some pre-C99 system libraries do not implement
|
this correctly so users cannot generally rely on the return value if
|
this correctly so users cannot generally rely on the return value if
|
the system version of this function is used.
|
the system version of this function is used.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c spaces.c:22
|
@c spaces.c:22
|
@deftypefn Extension char* spaces (int @var{count})
|
@deftypefn Extension char* spaces (int @var{count})
|
|
|
Returns a pointer to a memory region filled with the specified
|
Returns a pointer to a memory region filled with the specified
|
number of spaces and null terminated. The returned pointer is
|
number of spaces and null terminated. The returned pointer is
|
valid until at least the next call.
|
valid until at least the next call.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c stpcpy.c:23
|
@c stpcpy.c:23
|
@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src})
|
@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src})
|
|
|
Copies the string @var{src} into @var{dst}. Returns a pointer to
|
Copies the string @var{src} into @var{dst}. Returns a pointer to
|
@var{dst} + strlen(@var{src}).
|
@var{dst} + strlen(@var{src}).
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c stpncpy.c:23
|
@c stpncpy.c:23
|
@deftypefn Supplemental char* stpncpy (char *@var{dst}, const char *@var{src}, size_t @var{len})
|
@deftypefn Supplemental char* stpncpy (char *@var{dst}, const char *@var{src}, size_t @var{len})
|
|
|
Copies the string @var{src} into @var{dst}, copying exactly @var{len}
|
Copies the string @var{src} into @var{dst}, copying exactly @var{len}
|
and padding with zeros if necessary. If @var{len} < strlen(@var{src})
|
and padding with zeros if necessary. If @var{len} < strlen(@var{src})
|
then return @var{dst} + @var{len}, otherwise returns @var{dst} +
|
then return @var{dst} + @var{len}, otherwise returns @var{dst} +
|
strlen(@var{src}).
|
strlen(@var{src}).
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strcasecmp.c:15
|
@c strcasecmp.c:15
|
@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
|
@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
|
|
|
A case-insensitive @code{strcmp}.
|
A case-insensitive @code{strcmp}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strchr.c:6
|
@c strchr.c:6
|
@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
|
@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
|
|
|
Returns a pointer to the first occurrence of the character @var{c} in
|
Returns a pointer to the first occurrence of the character @var{c} in
|
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
null character, the results are undefined.
|
null character, the results are undefined.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strdup.c:3
|
@c strdup.c:3
|
@deftypefn Supplemental char* strdup (const char *@var{s})
|
@deftypefn Supplemental char* strdup (const char *@var{s})
|
|
|
Returns a pointer to a copy of @var{s} in memory obtained from
|
Returns a pointer to a copy of @var{s} in memory obtained from
|
@code{malloc}, or @code{NULL} if insufficient memory was available.
|
@code{malloc}, or @code{NULL} if insufficient memory was available.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strerror.c:670
|
@c strerror.c:670
|
@deftypefn Replacement {const char*} strerrno (int @var{errnum})
|
@deftypefn Replacement {const char*} strerrno (int @var{errnum})
|
|
|
Given an error number returned from a system call (typically returned
|
Given an error number returned from a system call (typically returned
|
in @code{errno}), returns a pointer to a string containing the
|
in @code{errno}), returns a pointer to a string containing the
|
symbolic name of that error number, as found in @code{<errno.h>}.
|
symbolic name of that error number, as found in @code{<errno.h>}.
|
|
|
If the supplied error number is within the valid range of indices for
|
If the supplied error number is within the valid range of indices for
|
symbolic names, but no name is available for the particular error
|
symbolic names, but no name is available for the particular error
|
number, then returns the string @samp{Error @var{num}}, where @var{num}
|
number, then returns the string @samp{Error @var{num}}, where @var{num}
|
is the error number.
|
is the error number.
|
|
|
If the supplied error number is not within the range of valid
|
If the supplied error number is not within the range of valid
|
indices, then returns @code{NULL}.
|
indices, then returns @code{NULL}.
|
|
|
The contents of the location pointed to are only guaranteed to be
|
The contents of the location pointed to are only guaranteed to be
|
valid until the next call to @code{strerrno}.
|
valid until the next call to @code{strerrno}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strerror.c:603
|
@c strerror.c:603
|
@deftypefn Supplemental char* strerror (int @var{errnoval})
|
@deftypefn Supplemental char* strerror (int @var{errnoval})
|
|
|
Maps an @code{errno} number to an error message string, the contents
|
Maps an @code{errno} number to an error message string, the contents
|
of which are implementation defined. On systems which have the
|
of which are implementation defined. On systems which have the
|
external variables @code{sys_nerr} and @code{sys_errlist}, these
|
external variables @code{sys_nerr} and @code{sys_errlist}, these
|
strings will be the same as the ones used by @code{perror}.
|
strings will be the same as the ones used by @code{perror}.
|
|
|
If the supplied error number is within the valid range of indices for
|
If the supplied error number is within the valid range of indices for
|
the @code{sys_errlist}, but no message is available for the particular
|
the @code{sys_errlist}, but no message is available for the particular
|
error number, then returns the string @samp{Error @var{num}}, where
|
error number, then returns the string @samp{Error @var{num}}, where
|
@var{num} is the error number.
|
@var{num} is the error number.
|
|
|
If the supplied error number is not a valid index into
|
If the supplied error number is not a valid index into
|
@code{sys_errlist}, returns @code{NULL}.
|
@code{sys_errlist}, returns @code{NULL}.
|
|
|
The returned string is only guaranteed to be valid only until the
|
The returned string is only guaranteed to be valid only until the
|
next call to @code{strerror}.
|
next call to @code{strerror}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strncasecmp.c:15
|
@c strncasecmp.c:15
|
@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
|
@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
|
|
|
A case-insensitive @code{strncmp}.
|
A case-insensitive @code{strncmp}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strncmp.c:6
|
@c strncmp.c:6
|
@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
|
@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
|
|
|
Compares the first @var{n} bytes of two strings, returning a value as
|
Compares the first @var{n} bytes of two strings, returning a value as
|
@code{strcmp}.
|
@code{strcmp}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strndup.c:23
|
@c strndup.c:23
|
@deftypefn Extension char* strndup (const char *@var{s}, size_t @var{n})
|
@deftypefn Extension char* strndup (const char *@var{s}, size_t @var{n})
|
|
|
Returns a pointer to a copy of @var{s} with at most @var{n} characters
|
Returns a pointer to a copy of @var{s} with at most @var{n} characters
|
in memory obtained from @code{malloc}, or @code{NULL} if insufficient
|
in memory obtained from @code{malloc}, or @code{NULL} if insufficient
|
memory was available. The result is always NUL terminated.
|
memory was available. The result is always NUL terminated.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strrchr.c:6
|
@c strrchr.c:6
|
@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
|
@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
|
|
|
Returns a pointer to the last occurrence of the character @var{c} in
|
Returns a pointer to the last occurrence of the character @var{c} in
|
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
null character, the results are undefined.
|
null character, the results are undefined.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strsignal.c:383
|
@c strsignal.c:383
|
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
|
|
Maps an signal number to an signal message string, the contents of
|
Maps an signal number to an signal message string, the contents of
|
which are implementation defined. On systems which have the external
|
which are implementation defined. On systems which have the external
|
variable @code{sys_siglist}, these strings will be the same as the
|
variable @code{sys_siglist}, these strings will be the same as the
|
ones used by @code{psignal()}.
|
ones used by @code{psignal()}.
|
|
|
If the supplied signal number is within the valid range of indices for
|
If the supplied signal number is within the valid range of indices for
|
the @code{sys_siglist}, but no message is available for the particular
|
the @code{sys_siglist}, but no message is available for the particular
|
signal number, then returns the string @samp{Signal @var{num}}, where
|
signal number, then returns the string @samp{Signal @var{num}}, where
|
@var{num} is the signal number.
|
@var{num} is the signal number.
|
|
|
If the supplied signal number is not a valid index into
|
If the supplied signal number is not a valid index into
|
@code{sys_siglist}, returns @code{NULL}.
|
@code{sys_siglist}, returns @code{NULL}.
|
|
|
The returned string is only guaranteed to be valid only until the next
|
The returned string is only guaranteed to be valid only until the next
|
call to @code{strsignal}.
|
call to @code{strsignal}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strsignal.c:448
|
@c strsignal.c:448
|
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
|
|
Given an signal number, returns a pointer to a string containing the
|
Given an signal number, returns a pointer to a string containing the
|
symbolic name of that signal number, as found in @code{<signal.h>}.
|
symbolic name of that signal number, as found in @code{<signal.h>}.
|
|
|
If the supplied signal number is within the valid range of indices for
|
If the supplied signal number is within the valid range of indices for
|
symbolic names, but no name is available for the particular signal
|
symbolic names, but no name is available for the particular signal
|
number, then returns the string @samp{Signal @var{num}}, where
|
number, then returns the string @samp{Signal @var{num}}, where
|
@var{num} is the signal number.
|
@var{num} is the signal number.
|
|
|
If the supplied signal number is not within the range of valid
|
If the supplied signal number is not within the range of valid
|
indices, then returns @code{NULL}.
|
indices, then returns @code{NULL}.
|
|
|
The contents of the location pointed to are only guaranteed to be
|
The contents of the location pointed to are only guaranteed to be
|
valid until the next call to @code{strsigno}.
|
valid until the next call to @code{strsigno}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strstr.c:6
|
@c strstr.c:6
|
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
|
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
|
|
|
This function searches for the substring @var{sub} in the string
|
This function searches for the substring @var{sub} in the string
|
@var{string}, not including the terminating null characters. A pointer
|
@var{string}, not including the terminating null characters. A pointer
|
to the first occurrence of @var{sub} is returned, or @code{NULL} if the
|
to the first occurrence of @var{sub} is returned, or @code{NULL} if the
|
substring is absent. If @var{sub} points to a string with zero
|
substring is absent. If @var{sub} points to a string with zero
|
length, the function returns @var{string}.
|
length, the function returns @var{string}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strtod.c:27
|
@c strtod.c:27
|
@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
|
@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
|
|
|
This ISO C function converts the initial portion of @var{string} to a
|
This ISO C function converts the initial portion of @var{string} to a
|
@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
|
@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
|
character after the last character used in the conversion is stored in
|
character after the last character used in the conversion is stored in
|
the location referenced by @var{endptr}. If no conversion is
|
the location referenced by @var{endptr}. If no conversion is
|
performed, zero is returned and the value of @var{string} is stored in
|
performed, zero is returned and the value of @var{string} is stored in
|
the location referenced by @var{endptr}.
|
the location referenced by @var{endptr}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strerror.c:729
|
@c strerror.c:729
|
@deftypefn Extension int strtoerrno (const char *@var{name})
|
@deftypefn Extension int strtoerrno (const char *@var{name})
|
|
|
Given the symbolic name of a error number (e.g., @code{EACCES}), map it
|
Given the symbolic name of a error number (e.g., @code{EACCES}), map it
|
to an errno value. If no translation is found, returns 0.
|
to an errno value. If no translation is found, returns 0.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strtol.c:33
|
@c strtol.c:33
|
@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
|
@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
|
@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
|
@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
|
|
|
The @code{strtol} function converts the string in @var{string} to a
|
The @code{strtol} function converts the string in @var{string} to a
|
long integer value according to the given @var{base}, which must be
|
long integer value according to the given @var{base}, which must be
|
between 2 and 36 inclusive, or be the special value 0. If @var{base}
|
between 2 and 36 inclusive, or be the special value 0. If @var{base}
|
is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
|
is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
|
to indicate bases 8 and 16, respectively, else default to base 10.
|
to indicate bases 8 and 16, respectively, else default to base 10.
|
When the base is 16 (either explicitly or implicitly), a prefix of
|
When the base is 16 (either explicitly or implicitly), a prefix of
|
@code{0x} is allowed. The handling of @var{endptr} is as that of
|
@code{0x} is allowed. The handling of @var{endptr} is as that of
|
@code{strtod} above. The @code{strtoul} function is the same, except
|
@code{strtod} above. The @code{strtoul} function is the same, except
|
that the converted value is unsigned.
|
that the converted value is unsigned.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strsignal.c:502
|
@c strsignal.c:502
|
@deftypefn Extension int strtosigno (const char *@var{name})
|
@deftypefn Extension int strtosigno (const char *@var{name})
|
|
|
Given the symbolic name of a signal, map it to a signal number. If no
|
Given the symbolic name of a signal, map it to a signal number. If no
|
translation is found, returns 0.
|
translation is found, returns 0.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c strverscmp.c:25
|
@c strverscmp.c:25
|
@deftypefun int strverscmp (const char *@var{s1}, const char *@var{s2})
|
@deftypefun int strverscmp (const char *@var{s1}, const char *@var{s2})
|
The @code{strverscmp} function compares the string @var{s1} against
|
The @code{strverscmp} function compares the string @var{s1} against
|
@var{s2}, considering them as holding indices/version numbers. Return
|
@var{s2}, considering them as holding indices/version numbers. Return
|
value follows the same conventions as found in the @code{strverscmp}
|
value follows the same conventions as found in the @code{strverscmp}
|
function. In fact, if @var{s1} and @var{s2} contain no digits,
|
function. In fact, if @var{s1} and @var{s2} contain no digits,
|
@code{strverscmp} behaves like @code{strcmp}.
|
@code{strverscmp} behaves like @code{strcmp}.
|
|
|
Basically, we compare strings normally (character by character), until
|
Basically, we compare strings normally (character by character), until
|
we find a digit in each string - then we enter a special comparison
|
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
|
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
|
end of these two parts without noticing a difference, we return to the
|
standard comparison mode. There are two types of numeric parts:
|
standard comparison mode. There are two types of numeric parts:
|
"integral" and "fractional" (those begin with a '0'). The types
|
"integral" and "fractional" (those begin with a '0'). The types
|
of the numeric parts affect the way we sort them:
|
of the numeric parts affect the way we sort them:
|
|
|
@itemize @bullet
|
@itemize @bullet
|
@item
|
@item
|
integral/integral: we compare values as you would expect.
|
integral/integral: we compare values as you would expect.
|
|
|
@item
|
@item
|
fractional/integral: the fractional part is less than the integral one.
|
fractional/integral: the fractional part is less than the integral one.
|
Again, no surprise.
|
Again, no surprise.
|
|
|
@item
|
@item
|
fractional/fractional: the things become a bit more complex.
|
fractional/fractional: the things become a bit more complex.
|
If the common prefix contains only leading zeroes, the longest part is less
|
If the common prefix contains only leading zeroes, the longest part is less
|
than the other one; else the comparison behaves normally.
|
than the other one; else the comparison behaves normally.
|
@end itemize
|
@end itemize
|
|
|
@smallexample
|
@smallexample
|
strverscmp ("no digit", "no digit")
|
strverscmp ("no digit", "no digit")
|
@result{} 0 // @r{same behavior as strcmp.}
|
@result{} 0 // @r{same behavior as strcmp.}
|
strverscmp ("item#99", "item#100")
|
strverscmp ("item#99", "item#100")
|
@result{} <0 // @r{same prefix, but 99 < 100.}
|
@result{} <0 // @r{same prefix, but 99 < 100.}
|
strverscmp ("alpha1", "alpha001")
|
strverscmp ("alpha1", "alpha001")
|
@result{} >0 // @r{fractional part inferior to integral one.}
|
@result{} >0 // @r{fractional part inferior to integral one.}
|
strverscmp ("part1_f012", "part1_f01")
|
strverscmp ("part1_f012", "part1_f01")
|
@result{} >0 // @r{two fractional parts.}
|
@result{} >0 // @r{two fractional parts.}
|
strverscmp ("foo.009", "foo.0")
|
strverscmp ("foo.009", "foo.0")
|
@result{} <0 // @r{idem, but with leading zeroes only.}
|
@result{} <0 // @r{idem, but with leading zeroes only.}
|
@end smallexample
|
@end smallexample
|
|
|
This function is especially useful when dealing with filename sorting,
|
This function is especially useful when dealing with filename sorting,
|
because filenames frequently hold indices/version numbers.
|
because filenames frequently hold indices/version numbers.
|
@end deftypefun
|
@end deftypefun
|
|
|
@c tmpnam.c:3
|
@c tmpnam.c:3
|
@deftypefn Supplemental char* tmpnam (char *@var{s})
|
@deftypefn Supplemental char* tmpnam (char *@var{s})
|
|
|
This function attempts to create a name for a temporary file, which
|
This function attempts to create a name for a temporary file, which
|
will be a valid file name yet not exist when @code{tmpnam} checks for
|
will be a valid file name yet not exist when @code{tmpnam} checks for
|
it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
|
it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
|
or be @code{NULL}. Use of this function creates a security risk, and it must
|
or be @code{NULL}. Use of this function creates a security risk, and it must
|
not be used in new projects. Use @code{mkstemp} instead.
|
not be used in new projects. Use @code{mkstemp} instead.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c unlink-if-ordinary.c:27
|
@c unlink-if-ordinary.c:27
|
@deftypefn Supplemental int unlink_if_ordinary (const char*)
|
@deftypefn Supplemental int unlink_if_ordinary (const char*)
|
|
|
Unlinks the named file, unless it is special (e.g. a device file).
|
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
|
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
|
there was an error deleting the file, and a positive value if no attempt
|
was made to unlink the file because it is special.
|
was made to unlink the file because it is special.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fopen_unlocked.c:31
|
@c fopen_unlocked.c:31
|
@deftypefn Extension void unlock_std_streams (void)
|
@deftypefn Extension void unlock_std_streams (void)
|
|
|
If the OS supports it, ensure that the standard I/O streams,
|
If the OS supports it, ensure that the standard I/O streams,
|
@code{stdin}, @code{stdout} and @code{stderr} are setup to avoid any
|
@code{stdin}, @code{stdout} and @code{stderr} are setup to avoid any
|
multi-threaded locking. Otherwise do nothing.
|
multi-threaded locking. Otherwise do nothing.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c fopen_unlocked.c:23
|
@c fopen_unlocked.c:23
|
@deftypefn Extension void unlock_stream (FILE * @var{stream})
|
@deftypefn Extension void unlock_stream (FILE * @var{stream})
|
|
|
If the OS supports it, ensure that the supplied stream is setup to
|
If the OS supports it, ensure that the supplied stream is setup to
|
avoid any multi-threaded locking. Otherwise leave the @code{FILE}
|
avoid any multi-threaded locking. Otherwise leave the @code{FILE}
|
pointer unchanged. If the @var{stream} is @code{NULL} do nothing.
|
pointer unchanged. If the @var{stream} is @code{NULL} do nothing.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c vasprintf.c:47
|
@c vasprintf.c:47
|
@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
|
@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
|
|
|
Like @code{vsprintf}, but instead of passing a pointer to a buffer,
|
Like @code{vsprintf}, but instead of passing a pointer to a buffer,
|
you pass a pointer to a pointer. This function will compute the size
|
you pass a pointer to a pointer. This function will compute the size
|
of the buffer needed, allocate memory with @code{malloc}, and store a
|
of the buffer needed, allocate memory with @code{malloc}, and store a
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
returned is the same as @code{vsprintf} would return. If memory could
|
returned is the same as @code{vsprintf} would return. If memory could
|
not be allocated, minus one is returned and @code{NULL} is stored in
|
not be allocated, minus one is returned and @code{NULL} is stored in
|
@code{*@var{resptr}}.
|
@code{*@var{resptr}}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c vfork.c:6
|
@c vfork.c:6
|
@deftypefn Supplemental int vfork (void)
|
@deftypefn Supplemental int vfork (void)
|
|
|
Emulates @code{vfork} by calling @code{fork} and returning its value.
|
Emulates @code{vfork} by calling @code{fork} and returning its value.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c vprintf.c:3
|
@c vprintf.c:3
|
@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
|
@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
|
@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
|
@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
|
@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
|
@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
|
|
|
These functions are the same as @code{printf}, @code{fprintf}, and
|
These functions are the same as @code{printf}, @code{fprintf}, and
|
@code{sprintf}, respectively, except that they are called with a
|
@code{sprintf}, respectively, except that they are called with a
|
@code{va_list} instead of a variable number of arguments. Note that
|
@code{va_list} instead of a variable number of arguments. Note that
|
they do not call @code{va_end}; this is the application's
|
they do not call @code{va_end}; this is the application's
|
responsibility. In @libib{} they are implemented in terms of the
|
responsibility. In @libib{} they are implemented in terms of the
|
nonstandard but common function @code{_doprnt}.
|
nonstandard but common function @code{_doprnt}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c vsnprintf.c:28
|
@c vsnprintf.c:28
|
@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap})
|
@deftypefn Supplemental int vsnprintf (char *@var{buf}, size_t @var{n}, const char *@var{format}, va_list @var{ap})
|
|
|
This function is similar to @code{vsprintf}, but it will write to
|
This function is similar to @code{vsprintf}, but it will write to
|
@var{buf} at most @code{@var{n}-1} bytes of text, followed by a
|
@var{buf} at most @code{@var{n}-1} bytes of text, followed by a
|
terminating null byte, for a total of @var{n} bytes. On error the
|
terminating null byte, for a total of @var{n} bytes. On error the
|
return value is -1, otherwise it returns the number of characters that
|
return value is -1, otherwise it returns the number of characters that
|
would have been printed had @var{n} been sufficiently large,
|
would have been printed had @var{n} been sufficiently large,
|
regardless of the actual value of @var{n}. Note some pre-C99 system
|
regardless of the actual value of @var{n}. Note some pre-C99 system
|
libraries do not implement this correctly so users cannot generally
|
libraries do not implement this correctly so users cannot generally
|
rely on the return value if the system version of this function is
|
rely on the return value if the system version of this function is
|
used.
|
used.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c waitpid.c:3
|
@c waitpid.c:3
|
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
|
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
|
|
|
This is a wrapper around the @code{wait} function. Any ``special''
|
This is a wrapper around the @code{wait} function. Any ``special''
|
values of @var{pid} depend on your implementation of @code{wait}, as
|
values of @var{pid} depend on your implementation of @code{wait}, as
|
does the return value. The third argument is unused in @libib{}.
|
does the return value. The third argument is unused in @libib{}.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c argv.c:306
|
@c argv.c:306
|
@deftypefn Extension int writeargv (const char **@var{argv}, FILE *@var{file})
|
@deftypefn Extension int writeargv (const char **@var{argv}, FILE *@var{file})
|
|
|
Write each member of ARGV, handling all necessary quoting, to the 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
|
named by FILE, separated by whitespace. Return 0 on success, non-zero
|
if an error occurred while writing to FILE.
|
if an error occurred while writing to FILE.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xatexit.c:11
|
@c xatexit.c:11
|
@deftypefun int xatexit (void (*@var{fn}) (void))
|
@deftypefun int xatexit (void (*@var{fn}) (void))
|
|
|
Behaves as the standard @code{atexit} function, but with no limit on
|
Behaves as the standard @code{atexit} function, but with no limit on
|
the number of registered functions. Returns 0 on success, or @minus{}1 on
|
the number of registered functions. Returns 0 on success, or @minus{}1 on
|
failure. If you use @code{xatexit} to register functions, you must use
|
failure. If you use @code{xatexit} to register functions, you must use
|
@code{xexit} to terminate your program.
|
@code{xexit} to terminate your program.
|
|
|
@end deftypefun
|
@end deftypefun
|
|
|
@c xmalloc.c:38
|
@c xmalloc.c:38
|
@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
|
@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
|
|
|
Allocate memory without fail, and set it to zero. This routine functions
|
Allocate memory without fail, and set it to zero. This routine functions
|
like @code{calloc}, but will behave the same as @code{xmalloc} if memory
|
like @code{calloc}, but will behave the same as @code{xmalloc} if memory
|
cannot be found.
|
cannot be found.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xexit.c:22
|
@c xexit.c:22
|
@deftypefn Replacement void xexit (int @var{code})
|
@deftypefn Replacement void xexit (int @var{code})
|
|
|
Terminates the program. If any functions have been registered with
|
Terminates the program. If any functions have been registered with
|
the @code{xatexit} replacement function, they will be called first.
|
the @code{xatexit} replacement function, they will be called first.
|
Termination is handled via the system's normal @code{exit} call.
|
Termination is handled via the system's normal @code{exit} call.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xmalloc.c:22
|
@c xmalloc.c:22
|
@deftypefn Replacement void* xmalloc (size_t)
|
@deftypefn Replacement void* xmalloc (size_t)
|
|
|
Allocate memory without fail. If @code{malloc} fails, this will print
|
Allocate memory without fail. If @code{malloc} fails, this will print
|
a message to @code{stderr} (using the name set by
|
a message to @code{stderr} (using the name set by
|
@code{xmalloc_set_program_name},
|
@code{xmalloc_set_program_name},
|
if any) and then call @code{xexit}. Note that it is therefore safe for
|
if any) and then call @code{xexit}. Note that it is therefore safe for
|
a program to contain @code{#define malloc xmalloc} in its source.
|
a program to contain @code{#define malloc xmalloc} in its source.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xmalloc.c:53
|
@c xmalloc.c:53
|
@deftypefn Replacement void xmalloc_failed (size_t)
|
@deftypefn Replacement void xmalloc_failed (size_t)
|
|
|
This function is not meant to be called by client code, and is listed
|
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
|
here for completeness only. If any of the allocation routines fail, this
|
function will be called to print an error message and terminate execution.
|
function will be called to print an error message and terminate execution.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xmalloc.c:46
|
@c xmalloc.c:46
|
@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
|
@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
|
|
|
You can use this to set the name of the program used by
|
You can use this to set the name of the program used by
|
@code{xmalloc_failed} when printing a failure message.
|
@code{xmalloc_failed} when printing a failure message.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xmemdup.c:7
|
@c xmemdup.c:7
|
@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
|
@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
|
|
|
Duplicates a region of memory without fail. First, @var{alloc_size} bytes
|
Duplicates a region of memory without fail. First, @var{alloc_size} bytes
|
are allocated, then @var{copy_size} bytes from @var{input} are copied into
|
are allocated, then @var{copy_size} bytes from @var{input} are copied into
|
it, and the new memory is returned. If fewer bytes are copied than were
|
it, and the new memory is returned. If fewer bytes are copied than were
|
allocated, the remaining memory is zeroed.
|
allocated, the remaining memory is zeroed.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xmalloc.c:32
|
@c xmalloc.c:32
|
@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
|
@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
|
Reallocate memory without fail. This routine functions like @code{realloc},
|
Reallocate memory without fail. This routine functions like @code{realloc},
|
but will behave the same as @code{xmalloc} if memory cannot be found.
|
but will behave the same as @code{xmalloc} if memory cannot be found.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xstrdup.c:7
|
@c xstrdup.c:7
|
@deftypefn Replacement char* xstrdup (const char *@var{s})
|
@deftypefn Replacement char* xstrdup (const char *@var{s})
|
|
|
Duplicates a character string without fail, using @code{xmalloc} to
|
Duplicates a character string without fail, using @code{xmalloc} to
|
obtain memory.
|
obtain memory.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xstrerror.c:7
|
@c xstrerror.c:7
|
@deftypefn Replacement char* xstrerror (int @var{errnum})
|
@deftypefn Replacement char* xstrerror (int @var{errnum})
|
|
|
Behaves exactly like the standard @code{strerror} function, but
|
Behaves exactly like the standard @code{strerror} function, but
|
will never return a @code{NULL} pointer.
|
will never return a @code{NULL} pointer.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
@c xstrndup.c:23
|
@c xstrndup.c:23
|
@deftypefn Replacement char* xstrndup (const char *@var{s}, size_t @var{n})
|
@deftypefn Replacement char* xstrndup (const char *@var{s}, size_t @var{n})
|
|
|
Returns a pointer to a copy of @var{s} with at most @var{n} characters
|
Returns a pointer to a copy of @var{s} with at most @var{n} characters
|
without fail, using @code{xmalloc} to obtain memory. The result is
|
without fail, using @code{xmalloc} to obtain memory. The result is
|
always NUL terminated.
|
always NUL terminated.
|
|
|
@end deftypefn
|
@end deftypefn
|
|
|
|
|
|
|