merge from gcc
This commit is contained in:
parent
a3366758ce
commit
ba19b94f67
24 changed files with 939 additions and 293 deletions
|
@ -1,3 +1,16 @@
|
||||||
|
2001-10-15 DJ Delorie <dj@redhat.com>
|
||||||
|
|
||||||
|
* Makefile.in (TEXIFILES): Add fnmatch.txh.
|
||||||
|
(maint-undoc): New.
|
||||||
|
maint-tool: Add "undoc" tool.
|
||||||
|
* alloca.c, argv.c, asprintf.c, choose-temp.c, concat.c,
|
||||||
|
fdmatch.c, ffs.c, getruntime.c, insque.c, lbasename.c,
|
||||||
|
make-temp-file.c, mkstemps.c, pexecute.c, random.c, spaces.c,
|
||||||
|
strerror.s, strsignal.c, strtol.c, vasprintf.c: Add or update
|
||||||
|
documentation.
|
||||||
|
* fnmatch.txh: New.
|
||||||
|
* functions.texi: Regenerate.
|
||||||
|
|
||||||
2001-10-10 Joseph S. Myers <jsm28@cam.ac.uk>
|
2001-10-10 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||||
|
|
||||||
* bcmp.c, setenv.c: Use "nonzero" instead of "non-zero".
|
* bcmp.c, setenv.c: Use "nonzero" instead of "non-zero".
|
||||||
|
|
|
@ -172,8 +172,9 @@ TEXISRC = \
|
||||||
$(srcdir)/functions.texi
|
$(srcdir)/functions.texi
|
||||||
|
|
||||||
# Additional files that have texi snippets that need to be collected
|
# Additional files that have texi snippets that need to be collected
|
||||||
# and sorted.
|
# and sorted. Some are here because the sources are imported from
|
||||||
TEXIFILES =
|
# elsewhere. Others represent headers in ../include.
|
||||||
|
TEXIFILES = fnmatch.txh
|
||||||
|
|
||||||
libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
|
libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
|
||||||
$(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
|
$(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
|
||||||
|
@ -257,6 +258,9 @@ maint-missing :
|
||||||
maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
|
maint-buildall : $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
|
||||||
@true
|
@true
|
||||||
|
|
||||||
|
maint-undoc : $(srcdir)/functions.texi
|
||||||
|
@$(PERL) $(srcdir)/maint-tool -s $(srcdir) undoc
|
||||||
|
|
||||||
# Need to deal with profiled libraries, too.
|
# Need to deal with profiled libraries, too.
|
||||||
|
|
||||||
# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
|
# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
|
||||||
|
|
|
@ -150,6 +150,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||||
caller, but that method cannot be made to work for some
|
caller, but that method cannot be made to work for some
|
||||||
implementations of C, for example under Gould's UTX/32. */
|
implementations of C, for example under Gould's UTX/32. */
|
||||||
|
|
||||||
|
/* @undocumented C_alloca */
|
||||||
|
|
||||||
PTR
|
PTR
|
||||||
C_alloca (size)
|
C_alloca (size)
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
108
libiberty/argv.c
108
libiberty/argv.c
|
@ -62,26 +62,15 @@ extern char *strdup (); /* Duplicate a string */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension char** dupargv (char **@var{vector})
|
||||||
|
|
||||||
dupargv -- duplicate an argument vector
|
Duplicate an argument vector. Simply scans through @var{vector},
|
||||||
|
duplicating each argument until the terminating @code{NULL} is found.
|
||||||
|
Returns a pointer to the argument vector if successful. Returns
|
||||||
|
@code{NULL} if there is insufficient memory to complete building the
|
||||||
|
argument vector.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
char **dupargv (vector)
|
|
||||||
char **vector;
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Duplicate an argument vector. Simply scans through the
|
|
||||||
vector, duplicating each argument until the
|
|
||||||
terminating NULL is found.
|
|
||||||
|
|
||||||
RETURNS
|
|
||||||
|
|
||||||
Returns a pointer to the argument vector if
|
|
||||||
successful. Returns NULL if there is insufficient memory to
|
|
||||||
complete building the argument vector.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -119,24 +108,14 @@ dupargv (argv)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension void freeargv (char **@var{vector})
|
||||||
|
|
||||||
freeargv -- free an argument vector
|
Free an argument vector that was built using @code{buildargv}. Simply
|
||||||
|
scans through @var{vector}, freeing the memory for each argument until
|
||||||
|
the terminating @code{NULL} is found, and then frees @var{vector}
|
||||||
|
itself.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
void freeargv (vector)
|
|
||||||
char **vector;
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Free an argument vector that was built using buildargv. Simply scans
|
|
||||||
through the vector, freeing the memory for each argument until the
|
|
||||||
terminating NULL is found, and then frees the vector itself.
|
|
||||||
|
|
||||||
RETURNS
|
|
||||||
|
|
||||||
No value.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -157,49 +136,42 @@ char **vector;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension char** buildargv (char *@var{sp})
|
||||||
|
|
||||||
buildargv -- build an argument vector from a string
|
Given a pointer to a string, parse the string extracting fields
|
||||||
|
separated by whitespace and optionally enclosed within either single
|
||||||
|
or double quotes (which are stripped off), and build a vector of
|
||||||
|
pointers to copies of the string for each field. The input string
|
||||||
|
remains unchanged. The last element of the vector is followed by a
|
||||||
|
@code{NULL} element.
|
||||||
|
|
||||||
SYNOPSIS
|
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
|
||||||
|
system with the single function call @code{freeargv}, which takes the
|
||||||
|
returned result of @code{buildargv}, as it's argument.
|
||||||
|
|
||||||
char **buildargv (sp)
|
Returns a pointer to the argument vector if successful. Returns
|
||||||
char *sp;
|
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
||||||
|
memory to complete building the argument vector.
|
||||||
|
|
||||||
DESCRIPTION
|
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
|
||||||
|
string.
|
||||||
|
|
||||||
Given a pointer to a string, parse the string extracting fields
|
@end deftypefn
|
||||||
separated by whitespace and optionally enclosed within either single
|
|
||||||
or double quotes (which are stripped off), and build a vector of
|
|
||||||
pointers to copies of the string for each field. The input string
|
|
||||||
remains unchanged.
|
|
||||||
|
|
||||||
All of the memory for the pointer array and copies of the string
|
The memory for the argv array is dynamically expanded as necessary.
|
||||||
is obtained from malloc. All of the memory can be returned to the
|
|
||||||
system with the single function call freeargv, which takes the
|
|
||||||
returned result of buildargv, as it's argument.
|
|
||||||
|
|
||||||
The memory for the argv array is dynamically expanded as necessary.
|
In order to provide a working buffer for extracting arguments into,
|
||||||
|
with appropriate stripping of quotes and translation of backslash
|
||||||
|
sequences, we allocate a working buffer at least as long as the input
|
||||||
|
string. This ensures that we always have enough space in which to
|
||||||
|
work, since the extracted arg is never larger than the input string.
|
||||||
|
|
||||||
RETURNS
|
The argument vector is always kept terminated with a @code{NULL} arg
|
||||||
|
pointer, so it can be passed to @code{freeargv} at any time, or
|
||||||
|
returned, as appropriate.
|
||||||
|
|
||||||
Returns a pointer to the argument vector if successful. Returns NULL
|
|
||||||
if the input string pointer is NULL or if there is insufficient
|
|
||||||
memory to complete building the argument vector.
|
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
In order to provide a working buffer for extracting arguments into,
|
|
||||||
with appropriate stripping of quotes and translation of backslash
|
|
||||||
sequences, we allocate a working buffer at least as long as the input
|
|
||||||
string. This ensures that we always have enough space in which to
|
|
||||||
work, since the extracted arg is never larger than the input string.
|
|
||||||
|
|
||||||
If the input is a null string (as opposed to a NULL pointer), then
|
|
||||||
buildarg returns an argv that has one arg, a null string.
|
|
||||||
|
|
||||||
Argv is always kept terminated with a NULL arg pointer, so it can
|
|
||||||
be passed to freeargv at any time, or returned, as appropriate.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char **buildargv (input)
|
char **buildargv (input)
|
||||||
|
|
|
@ -28,6 +28,22 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Extension int asprintf (char **@var{resptr}, char *@var{format}, ...)
|
||||||
|
|
||||||
|
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
|
||||||
|
the buffer needed, allocate memory with @code{malloc}, and store a
|
||||||
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||||
|
returned is the same as @code{sprintf} would return. If memory could
|
||||||
|
not be allocated, zero is returned and @code{NULL} is stored in
|
||||||
|
@code{*@var{resptr}}.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
asprintf VPARAMS ((char **buf, const char *fmt, ...))
|
asprintf VPARAMS ((char **buf, const char *fmt, ...))
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,13 +37,21 @@ extern char *choose_tmpdir PARAMS ((void));
|
||||||
#define TEMP_FILE "ccXXXXXX"
|
#define TEMP_FILE "ccXXXXXX"
|
||||||
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
|
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
|
||||||
|
|
||||||
/* Return a prefix for temporary file names or NULL if unable to find one.
|
/*
|
||||||
The current directory is chosen if all else fails so the program is
|
|
||||||
exited if a temporary directory can't be found (mktemp fails).
|
|
||||||
The buffer for the result is obtained with xmalloc.
|
|
||||||
|
|
||||||
This function is provided for backwards compatability only. It use
|
@deftypefn Extension char* choose_temp_base ()
|
||||||
is not recommended. */
|
|
||||||
|
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
|
||||||
|
program is exited if a temporary directory can't be found (@code{mktemp}
|
||||||
|
fails). The buffer for the result is obtained with @code{xmalloc}.
|
||||||
|
|
||||||
|
This function is provided for backwards compatability only. Its use is
|
||||||
|
not recommended.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
choose_temp_base ()
|
choose_temp_base ()
|
||||||
|
|
|
@ -21,24 +21,14 @@ Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension char* concat (char *@var{s1}, char *@var{s2}, ..., @code{NULL})
|
||||||
|
|
||||||
concat -- concatenate a variable number of strings
|
Concatenate zero or more of strings and return the result in freshly
|
||||||
|
xmalloc'd memory. Returns @code{NULL} if insufficient memory is
|
||||||
|
available. The argument list is terminated by the first @code{NULL}
|
||||||
|
pointer encountered. Pointers to empty strings are ignored.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
#include <varargs.h>
|
|
||||||
|
|
||||||
char *concat (s1, s2, s3, ..., NULL)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Concatenate a variable number of strings and return the result
|
|
||||||
in freshly malloc'd memory.
|
|
||||||
|
|
||||||
Returns NULL if insufficient memory is available. The argument
|
|
||||||
list is terminated by the first NULL pointer encountered. Pointers
|
|
||||||
to empty strings are ignored.
|
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
@ -50,6 +40,7 @@ NOTES
|
||||||
deal with low memory situations itself, it should supply an xmalloc
|
deal with low memory situations itself, it should supply an xmalloc
|
||||||
that just directly invokes malloc and blindly returns whatever
|
that just directly invokes malloc and blindly returns whatever
|
||||||
malloc returns.
|
malloc returns.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +105,8 @@ vconcat_copy (dst, first, args)
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @undocumented concat_length */
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
concat_length VPARAMS ((const char *first, ...))
|
concat_length VPARAMS ((const char *first, ...))
|
||||||
{
|
{
|
||||||
|
@ -127,6 +120,8 @@ concat_length VPARAMS ((const char *first, ...))
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @undocumented concat_copy */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
concat_copy VPARAMS ((char *dst, const char *first, ...))
|
concat_copy VPARAMS ((char *dst, const char *first, ...))
|
||||||
{
|
{
|
||||||
|
@ -144,6 +139,8 @@ concat_copy VPARAMS ((char *dst, const char *first, ...))
|
||||||
|
|
||||||
char *libiberty_concat_ptr;
|
char *libiberty_concat_ptr;
|
||||||
|
|
||||||
|
/* @undocumented concat_copy2 */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
concat_copy2 VPARAMS ((const char *first, ...))
|
concat_copy2 VPARAMS ((const char *first, ...))
|
||||||
{
|
{
|
||||||
|
@ -175,6 +172,23 @@ concat VPARAMS ((const char *first, ...))
|
||||||
return newstr;
|
return newstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Extension char* reconcat (char *@var{optr}, char *@var{s1}, ..., @code{NULL})
|
||||||
|
|
||||||
|
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
|
||||||
|
when you're extending an existing string or building up a string in a
|
||||||
|
loop:
|
||||||
|
|
||||||
|
@example
|
||||||
|
str = reconcat (str, "pre-", str, NULL);
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
reconcat VPARAMS ((char *optr, const char *first, ...))
|
reconcat VPARAMS ((char *optr, const char *first, ...))
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,25 +20,19 @@ Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
||||||
|
|
||||||
fdmatch -- see if two file descriptors refer to 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
|
||||||
|
an unnamed file, and the name of a file that we believe to correspond
|
||||||
|
to that fd. This can happen when we are exec'd with an already open
|
||||||
|
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
||||||
|
that return open file descriptors for mapped address spaces. All we
|
||||||
|
have to do is open the file by name and check the two file descriptors
|
||||||
|
for a match, which is done by comparing major and minor device numbers
|
||||||
|
and inode numbers.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
int fdmatch (int fd1, int fd2)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Check to see if two open file descriptors refer to the same file.
|
|
||||||
This is useful, for example, when we have an open file descriptor
|
|
||||||
for an unnamed file, and the name of a file that we believe to
|
|
||||||
correspond to that fd. This can happen when we are exec'd with
|
|
||||||
an already open file (stdout for example) or from the SVR4 /proc
|
|
||||||
calls that return open file descriptors for mapped address spaces.
|
|
||||||
All we have to do is open the file by name and check the two file
|
|
||||||
descriptors for a match, which is done by comparing major&minor
|
|
||||||
device numbers and inode numbers.
|
|
||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
/* ffs -- Find the first bit set in the parameter
|
/* ffs -- Find the first bit set in the parameter
|
||||||
|
|
||||||
NAME
|
@deftypefn Supplemental int ffs (int @var{valu})
|
||||||
ffs -- Find the first bit set in the parameter
|
|
||||||
|
|
||||||
SYNOPSIS
|
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||||
int ffs (int valu)
|
numbered from right to left, starting with bit 1 (corresponding to the
|
||||||
|
value 1). If @var{valu} is zero, zero is returned.
|
||||||
|
|
||||||
DESCRIPTION
|
@end deftypefn
|
||||||
Find the first bit set in the parameter. Bits are numbered from
|
|
||||||
right to left, starting with bit 1.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
48
libiberty/fnmatch.txh
Normal file
48
libiberty/fnmatch.txh
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
@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, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||||
|
wildcards @code{?} to match any one character, @code{*} to match any
|
||||||
|
zero or more characters, or a set of alternate characters in square
|
||||||
|
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
|
||||||
|
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
|
||||||
|
character in the set. To include those characters in the set, list them
|
||||||
|
as anything other than the first character of the set. To include a
|
||||||
|
dash in the set, list it last in the set. A backslash character makes
|
||||||
|
the following character not special, so for example you could match
|
||||||
|
against a literal asterisk with @samp{\*}. To match a literal
|
||||||
|
backslash, use @samp{\\}.
|
||||||
|
|
||||||
|
@code{flags} controls various aspects of the matching process, and is a
|
||||||
|
boolean OR of zero or more of the following values (defined in
|
||||||
|
@code{<fnmatch.h>}:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
|
||||||
|
@item FNM_PATHNAME
|
||||||
|
@itemx FNM_FILE_NAME
|
||||||
|
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||||
|
@code{/}.
|
||||||
|
|
||||||
|
@item FNM_NOESCAPE
|
||||||
|
Do not interpret backslashes as quoting the following special character.
|
||||||
|
|
||||||
|
@item FNM_PERIOD
|
||||||
|
A leading period (at the beginning of @var{string}, or if
|
||||||
|
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||||
|
@code{?} but must be matched explicitly.
|
||||||
|
|
||||||
|
@item FNM_LEADING_DIR
|
||||||
|
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
|
||||||
|
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||||
|
or @samp{foobar/grill}.
|
||||||
|
|
||||||
|
@item FNM_CASEFOLD
|
||||||
|
Ignores case when performing the comparison.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@end deftypefn
|
|
@ -21,6 +21,19 @@ the possibility of a GCC built-in function.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c asprintf.c:33
|
||||||
|
@deftypefn Extension int asprintf (char **@var{resptr}, char *@var{format}, ...)
|
||||||
|
|
||||||
|
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
|
||||||
|
the buffer needed, allocate memory with @code{malloc}, and store a
|
||||||
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||||
|
returned is the same as @code{sprintf} would return. If memory could
|
||||||
|
not be allocated, zero is returned and @code{NULL} is stored in
|
||||||
|
@code{*@var{resptr}}.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@c atexit.c:6
|
@c atexit.c:6
|
||||||
@deftypefn Supplemental int atexit (void (*@var{f})())
|
@deftypefn Supplemental int atexit (void (*@var{f})())
|
||||||
|
|
||||||
|
@ -69,6 +82,31 @@ is respectively less than, matching, or greater than the array member.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c argv.c:139
|
||||||
|
@deftypefn Extension char** buildargv (char *@var{sp})
|
||||||
|
|
||||||
|
Given a pointer to a string, parse the string extracting fields
|
||||||
|
separated by whitespace and optionally enclosed within either single
|
||||||
|
or double quotes (which are stripped off), and build a vector of
|
||||||
|
pointers to copies of the string for each field. The input string
|
||||||
|
remains unchanged. The last element of the vector is followed by a
|
||||||
|
@code{NULL} element.
|
||||||
|
|
||||||
|
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
|
||||||
|
system with the single function call @code{freeargv}, which takes the
|
||||||
|
returned result of @code{buildargv}, as it's argument.
|
||||||
|
|
||||||
|
Returns a pointer to the argument vector if successful. Returns
|
||||||
|
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
||||||
|
memory to complete building the argument vector.
|
||||||
|
|
||||||
|
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
|
||||||
|
string.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -85,6 +123,27 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c choose-temp.c:42
|
||||||
|
@deftypefn Extension char* choose_temp_base ()
|
||||||
|
|
||||||
|
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
|
||||||
|
program is exited if a temporary directory can't be found (@code{mktemp}
|
||||||
|
fails). The buffer for the result is obtained with @code{xmalloc}.
|
||||||
|
|
||||||
|
This function is provided for backwards compatability only. Its use is
|
||||||
|
not recommended.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c make-temp-file.c:88
|
||||||
|
@deftypefn Replacement char* choose_tmpdir ()
|
||||||
|
|
||||||
|
Returns a pointer to a directory path suitable for creating temporary
|
||||||
|
files in.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@c clock.c:27
|
@c clock.c:27
|
||||||
@deftypefn Supplemental long clock (void)
|
@deftypefn Supplemental long clock (void)
|
||||||
|
|
||||||
|
@ -94,8 +153,29 @@ number of seconds used.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c concat.c:24
|
||||||
|
@deftypefn Extension char* concat (char *@var{s1}, char *@var{s2}, ..., @code{NULL})
|
||||||
|
|
||||||
|
Concatenate zero or more of strings and return the result in freshly
|
||||||
|
xmalloc'd memory. Returns @code{NULL} if insufficient memory is
|
||||||
|
available. The argument list is terminated by the first @code{NULL}
|
||||||
|
pointer encountered. Pointers to empty strings are ignored.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c argv.c:65
|
||||||
|
@deftypefn Extension char** dupargv (char **@var{vector})
|
||||||
|
|
||||||
|
Duplicate an argument vector. Simply scans through @var{vector},
|
||||||
|
duplicating each argument until the terminating @code{NULL} is found.
|
||||||
|
Returns a pointer to the argument vector if successful. Returns
|
||||||
|
@code{NULL} if there is insufficient memory to complete building the
|
||||||
|
argument vector.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@c strerror.c:566
|
@c strerror.c:566
|
||||||
@deftypefn Replacement 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
|
||||||
|
@ -112,6 +192,99 @@ symbolic name or message.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c fdmatch.c:23
|
||||||
|
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
||||||
|
|
||||||
|
Check to see if two open file descriptors refer to the same file.
|
||||||
|
This is useful, for example, when we have an open file descriptor for
|
||||||
|
an unnamed file, and the name of a file that we believe to correspond
|
||||||
|
to that fd. This can happen when we are exec'd with an already open
|
||||||
|
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
||||||
|
that return open file descriptors for mapped address spaces. All we
|
||||||
|
have to do is open the file by name and check the two file descriptors
|
||||||
|
for a match, which is done by comparing major and minor device numbers
|
||||||
|
and inode numbers.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c ffs.c:3
|
||||||
|
@deftypefn Supplemental int ffs (int @var{valu})
|
||||||
|
|
||||||
|
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||||
|
numbered from right to left, starting with bit 1 (corresponding to the
|
||||||
|
value 1). If @var{valu} is zero, zero is returned.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c fnmatch.txh:1
|
||||||
|
@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, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||||
|
wildcards @code{?} to match any one character, @code{*} to match any
|
||||||
|
zero or more characters, or a set of alternate characters in square
|
||||||
|
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
|
||||||
|
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
|
||||||
|
character in the set. To include those characters in the set, list them
|
||||||
|
as anything other than the first character of the set. To include a
|
||||||
|
dash in the set, list it last in the set. A backslash character makes
|
||||||
|
the following character not special, so for example you could match
|
||||||
|
against a literal asterisk with @samp{\*}. To match a literal
|
||||||
|
backslash, use @samp{\\}.
|
||||||
|
|
||||||
|
@code{flags} controls various aspects of the matching process, and is a
|
||||||
|
boolean OR of zero or more of the following values (defined in
|
||||||
|
@code{<fnmatch.h>}:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
|
||||||
|
@item FNM_PATHNAME
|
||||||
|
@itemx FNM_FILE_NAME
|
||||||
|
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||||
|
@code{/}.
|
||||||
|
|
||||||
|
@item FNM_NOESCAPE
|
||||||
|
Do not interpret backslashes as quoting the following special character.
|
||||||
|
|
||||||
|
@item FNM_PERIOD
|
||||||
|
A leading period (at the beginning of @var{string}, or if
|
||||||
|
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||||
|
@code{?} but must be matched explicitly.
|
||||||
|
|
||||||
|
@item FNM_LEADING_DIR
|
||||||
|
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
|
||||||
|
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||||
|
or @samp{foobar/grill}.
|
||||||
|
|
||||||
|
@item FNM_CASEFOLD
|
||||||
|
Ignores case when performing the comparison.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c argv.c:111
|
||||||
|
@deftypefn Extension void freeargv (char **@var{vector})
|
||||||
|
|
||||||
|
Free an argument vector that was built using @code{buildargv}. Simply
|
||||||
|
scans through @var{vector}, freeing the memory for each argument until
|
||||||
|
the terminating @code{NULL} is found, and then frees @var{vector}
|
||||||
|
itself.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c getruntime.c:78
|
||||||
|
@deftypefn Replacement long get_run_time ()
|
||||||
|
|
||||||
|
Returns the time used so far, in microseconds. If possible, this is
|
||||||
|
the time used by this process, else it is the elapsed time since the
|
||||||
|
process started.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -153,6 +326,52 @@ deprecated in new programs in favor of @code{strchr}.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c insque.c:6
|
||||||
|
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
||||||
|
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
||||||
|
|
||||||
|
Routines to manipulate queues built from doubly linked lists. The
|
||||||
|
@code{insque} routine inserts @var{elem} in the queue immediately
|
||||||
|
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
||||||
|
its containing queue. These routines expect to be passed pointers to
|
||||||
|
structures which have as their first members a forward pointer and a
|
||||||
|
back pointer, like this prototype (although no prototype is provided):
|
||||||
|
|
||||||
|
@example
|
||||||
|
struct qelem @{
|
||||||
|
struct qelem *q_forw;
|
||||||
|
struct qelem *q_back;
|
||||||
|
char q_data[];
|
||||||
|
@};
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c lbasename.c:23
|
||||||
|
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
||||||
|
|
||||||
|
Given a pointer to a string containing a typical pathname
|
||||||
|
(@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
|
||||||
|
returned pointer is guaranteed to lie within the original
|
||||||
|
string. This latter fact is not true of many vendor C
|
||||||
|
libraries, which return special strings or modify the passed
|
||||||
|
strings for particular input.
|
||||||
|
|
||||||
|
In particular, the empty string returns the same empty string,
|
||||||
|
and a path ending in @code{/} returns the empty string after it.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c make-temp-file.c:138
|
||||||
|
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||||
|
|
||||||
|
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
|
||||||
|
string is malloced, and the temporary file has been created.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -201,6 +420,71 @@ Sets the first @var{count} bytes of @var{s} to the constant byte
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c mkstemps.c:54
|
||||||
|
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||||
|
|
||||||
|
Generate a unique temporary file name from @var{template}.
|
||||||
|
@var{template} has the form:
|
||||||
|
|
||||||
|
@example
|
||||||
|
<path>/ccXXXXXX<suffix>
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@var{suffix_len} tells us how long <suffix> is (it can be zero
|
||||||
|
length). The last six characters of @var{template} before <suffix>
|
||||||
|
must be @code{XXXXXX}; they are replaced with a string that makes the
|
||||||
|
filename unique. Returns a file descriptor open on the file for
|
||||||
|
reading and writing.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c pexecute.c:67
|
||||||
|
@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 flags)
|
||||||
|
|
||||||
|
Executes a program.
|
||||||
|
|
||||||
|
@var{program} and @var{argv} are the arguments to
|
||||||
|
@code{execv}/@code{execvp}.
|
||||||
|
|
||||||
|
@var{this_pname} is name of the calling program (i.e. @code{argv[0]}).
|
||||||
|
|
||||||
|
@var{temp_base} is the path name, sans suffix, of a temporary file to
|
||||||
|
use if needed. This is currently only needed for MS-DOS ports that
|
||||||
|
don't use @code{go32} (do any still exist?). Ports that don't need it
|
||||||
|
can pass @code{NULL}.
|
||||||
|
|
||||||
|
(@var{flags} & @code{PEXECUTE_SEARCH}) is non-zero if @code{$PATH} should be searched
|
||||||
|
(??? It's not clear that GCC passes this flag correctly). (@var{flags} &
|
||||||
|
@code{PEXECUTE_FIRST}) is nonzero for the first process in chain.
|
||||||
|
(@var{flags} & @code{PEXECUTE_FIRST}) is nonzero for the last process
|
||||||
|
in chain. The first/last flags could be simplified to only mark the
|
||||||
|
last of a chain of processes but that requires the caller to always
|
||||||
|
mark the last one (and not give up early if some error occurs).
|
||||||
|
It's more robust to require the caller to mark both ends of the chain.
|
||||||
|
|
||||||
|
The result is the pid on systems like Unix where we
|
||||||
|
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
|
||||||
|
use @code{spawn}. It is up to the caller to wait for the child.
|
||||||
|
|
||||||
|
The result is the WEXITSTATUS on systems like MS-DOS where we
|
||||||
|
@code{spawn} and wait for the child here.
|
||||||
|
|
||||||
|
Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
|
||||||
|
text of the error message with an optional argument (if not needed,
|
||||||
|
@var{errmsg_arg} is set to @code{NULL}), and -1 is returned.
|
||||||
|
@code{errno} is available to the caller to use.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c strsignal.c:547
|
||||||
|
@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
|
||||||
|
|
||||||
|
Print @var{message} to the standard error, followed by a colon,
|
||||||
|
followed by the description of the signal specified by @var{signo},
|
||||||
|
followed by a newline.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -211,6 +495,53 @@ name is unset/removed.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c pexecute.c:104
|
||||||
|
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
||||||
|
|
||||||
|
Waits for a program started by @code{pexecute} to finish.
|
||||||
|
|
||||||
|
@var{pid} is the process id of the task to wait for. @var{status} is
|
||||||
|
the `status' argument to wait. @var{flags} is currently unused (allows
|
||||||
|
future enhancement without breaking upward compatibility). Pass 0 for now.
|
||||||
|
|
||||||
|
The result is the pid of the child reaped, or -1 for failure
|
||||||
|
(@code{errno} says why).
|
||||||
|
|
||||||
|
On systems that don't support waiting for a particular child, @var{pid} is
|
||||||
|
ignored. On systems like MS-DOS that don't really multitask @code{pwait}
|
||||||
|
is just a mechanism to provide a consistent interface for the caller.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c random.c:39
|
||||||
|
@deftypefn Supplement {long int} random ()
|
||||||
|
@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* setstate (void *@var{arg_state})
|
||||||
|
|
||||||
|
Random number functions. @code{random} returns a random number in the
|
||||||
|
range @code{0..LONG_MAX}. @code{srandom} initializes the random
|
||||||
|
number generator to some starting point determined by @var{seed}
|
||||||
|
(else, the values returned by @code{random} are always the same for each
|
||||||
|
run of the program). @code{initstate} and @code{setstate} allow fine-grain
|
||||||
|
control over the state of the random number generator.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c concat.c:177
|
||||||
|
@deftypefn Extension char* reconcat (char *@var{optr}, char *@var{s1}, ..., @code{NULL})
|
||||||
|
|
||||||
|
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
|
||||||
|
when you're extending an existing string or building up a string in a
|
||||||
|
loop:
|
||||||
|
|
||||||
|
@example
|
||||||
|
str = reconcat (str, "pre-", str, NULL);
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -240,6 +571,24 @@ environment. This implementation is not safe for multithreaded code.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c strsignal.c:353
|
||||||
|
@deftypefn Extension int signo_max ()
|
||||||
|
|
||||||
|
Returns the maximum signal value for which a corresponding symbolic
|
||||||
|
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
|
||||||
|
be more symbolic names than messages, or vice versa. In fact, the
|
||||||
|
manual page for @code{psignal(3b)} explicitly warns that one should
|
||||||
|
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
|
||||||
|
the table. Thus @code{NSIG} might be smaller than value implied by
|
||||||
|
the largest signo value defined in @code{<signal.h>}.
|
||||||
|
|
||||||
|
We return the maximum value that can be used to obtain a meaningful
|
||||||
|
symbolic name or message.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@c sigsetmask.c:8
|
@c sigsetmask.c:8
|
||||||
@deftypefn Supplemental int sigsetmask (int @var{set})
|
@deftypefn Supplemental int sigsetmask (int @var{set})
|
||||||
|
|
||||||
|
@ -249,6 +598,15 @@ be the value @code{1}).
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c spaces.c:22
|
||||||
|
@deftypefn Extension char* spaces (int @var{count})
|
||||||
|
|
||||||
|
Returns a pointer to a memory region filled with the specified
|
||||||
|
number of spaces and null terminated. The returned pointer is
|
||||||
|
valid until at least the next call.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -274,7 +632,7 @@ Returns a pointer to a copy of @var{s} in memory obtained from
|
||||||
@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
|
||||||
|
@ -282,7 +640,7 @@ 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
|
||||||
|
@ -294,7 +652,7 @@ valid until the next call to @code{strerrno}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@c strerror.c:602
|
@c strerror.c:602
|
||||||
@deftypefn Replacement 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
|
||||||
|
@ -303,7 +661,7 @@ 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
|
||||||
|
@ -338,6 +696,46 @@ null character, the results are undefined.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c strsignal.c:388
|
||||||
|
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
||||||
|
|
||||||
|
Maps an signal number to an signal message string, the contents of
|
||||||
|
which are implementation defined. On systems which have the external
|
||||||
|
variable @code{sys_siglist}, these strings will be the same as the
|
||||||
|
ones used by @code{psignal()}.
|
||||||
|
|
||||||
|
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
|
||||||
|
signal number, then returns the string @samp{Signal @var{num}}, where
|
||||||
|
@var{num} is the signal number.
|
||||||
|
|
||||||
|
If the supplied signal number is not a valid index into
|
||||||
|
@code{sys_siglist}, returns @code{NULL}.
|
||||||
|
|
||||||
|
The returned string is only guaranteed to be valid only until the next
|
||||||
|
call to @code{strsignal}.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c strsignal.c:452
|
||||||
|
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
||||||
|
|
||||||
|
Given an signal number, returns a pointer to a string containing the
|
||||||
|
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
|
||||||
|
symbolic names, but no name is available for the particular signal
|
||||||
|
number, then returns the string @samp{Signal @var{num}}, where
|
||||||
|
@var{num} is the signal number.
|
||||||
|
|
||||||
|
If the supplied signal number is not within the range of valid
|
||||||
|
indices, then returns @code{NULL}.
|
||||||
|
|
||||||
|
The contents of the location pointed to are only guaranteed to be
|
||||||
|
valid until the next call to @code{strsigno}.
|
||||||
|
|
||||||
|
@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})
|
||||||
|
|
||||||
|
@ -362,7 +760,7 @@ the location referenced by @var{endptr}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@c strerror.c:730
|
@c strerror.c:730
|
||||||
@deftypefn Replacement 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.
|
||||||
|
@ -371,6 +769,7 @@ to an errno value. If no translation is found, returns 0.
|
||||||
|
|
||||||
@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})
|
||||||
|
|
||||||
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
|
||||||
|
@ -379,7 +778,16 @@ 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.
|
@code{strtod} above. The @code{strtoul} function is the same, except
|
||||||
|
that the converted value is unsigned.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@c strsignal.c:507
|
||||||
|
@deftypefn Extension int strtosigno (const char *@var{name})
|
||||||
|
|
||||||
|
Given the symbolic name of a signal, map it to a signal number. If no
|
||||||
|
translation is found, returns 0.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@ -394,6 +802,19 @@ not be used in new projects. Use @code{mkstemp} instead.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
@c vasprintf.c:48
|
||||||
|
@deftypefn Extension int vasprintf (char **@var{resptr}, char *@var{format}, va_list @var{args})
|
||||||
|
|
||||||
|
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
|
||||||
|
of the buffer needed, allocate memory with @code{malloc}, and store a
|
||||||
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||||
|
returned is the same as @code{vsprintf} would return. If memory could
|
||||||
|
not be allocated, zero is returned and @code{NULL} is stored in
|
||||||
|
@code{*@var{resptr}}.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
@c vfork.c:6
|
@c vfork.c:6
|
||||||
@deftypefn Supplemental int vfork (void)
|
@deftypefn Supplemental int vfork (void)
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,18 @@ Boston, MA 02111-1307, USA. */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Replacement long get_run_time ()
|
||||||
|
|
||||||
|
Returns the time used so far, in microseconds. If possible, this is
|
||||||
|
the time used by this process, else it is the elapsed time since the
|
||||||
|
process started.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
long
|
long
|
||||||
get_run_time ()
|
get_run_time ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,24 +2,27 @@
|
||||||
This file is in the public domain. */
|
This file is in the public domain. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NAME
|
|
||||||
insque, remque -- insert, remove an element from a queue
|
|
||||||
|
|
||||||
SYNOPSIS
|
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
||||||
struct qelem {
|
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
||||||
struct qelem *q_forw;
|
|
||||||
struct qelem *q_back;
|
|
||||||
char q_data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
void insque (struct qelem *elem, struct qelem *pred)
|
Routines to manipulate queues built from doubly linked lists. The
|
||||||
|
@code{insque} routine inserts @var{elem} in the queue immediately
|
||||||
|
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
||||||
|
its containing queue. These routines expect to be passed pointers to
|
||||||
|
structures which have as their first members a forward pointer and a
|
||||||
|
back pointer, like this prototype (although no prototype is provided):
|
||||||
|
|
||||||
void remque (struct qelem *elem)
|
@example
|
||||||
|
struct qelem @{
|
||||||
|
struct qelem *q_forw;
|
||||||
|
struct qelem *q_back;
|
||||||
|
char q_data[];
|
||||||
|
@};
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Routines to manipulate queues built from doubly linked lists.
|
|
||||||
The insque routine inserts ELEM in the queue immediately after
|
|
||||||
PRED. The remque routine removes ELEM from its containing queue.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,23 +19,22 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NAME
|
|
||||||
lbasename -- return pointer to last component of a pathname
|
|
||||||
|
|
||||||
SYNOPSIS
|
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
||||||
const char *lbasename (const char *name)
|
|
||||||
|
|
||||||
DESCRIPTION
|
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
|
||||||
(/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 ("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,
|
||||||
|
and a path ending in @code{/} returns the empty string after it.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
In particular, the empty string returns the same empty string,
|
|
||||||
and a path ending in '/' returns the empty string after it.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
|
|
|
@ -35,9 +35,17 @@ if ($mode eq "-s") {
|
||||||
}
|
}
|
||||||
|
|
||||||
&missing() if $mode eq "missing";
|
&missing() if $mode eq "missing";
|
||||||
|
&undoc() if $mode eq "undoc";
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
format STDOUT =
|
||||||
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
|
||||||
|
$out
|
||||||
|
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
|
||||||
|
$out
|
||||||
|
.
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
sub missing {
|
sub missing {
|
||||||
|
@ -73,3 +81,100 @@ sub missing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
sub undoc {
|
||||||
|
|
||||||
|
opendir(S, $srcdir);
|
||||||
|
while ($file = readdir S) {
|
||||||
|
if ($file =~ /\.texi$/) {
|
||||||
|
open(T, "$srcdir/$file");
|
||||||
|
while (<T>) {
|
||||||
|
if (/^\@deftype[^\(]* ([^\s\(]+) *\(/) {
|
||||||
|
$documented{$1} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(T);
|
||||||
|
}
|
||||||
|
if ($file =~ /\.c$/) {
|
||||||
|
open(C, "$srcdir/$file");
|
||||||
|
while (<C>) {
|
||||||
|
if (/\@undocumented (\S+)/) {
|
||||||
|
$documented{$1} = 1;
|
||||||
|
}
|
||||||
|
if (/^static /) {
|
||||||
|
if (! /[\(;]/) {
|
||||||
|
s/[\r\n]+$/ /;
|
||||||
|
$_ .= <C>;
|
||||||
|
}
|
||||||
|
while ($_ =~ /\([^\)]*$/) {
|
||||||
|
s/[\r\n]+$/ /;
|
||||||
|
$_ .= <C>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s/ VPARAMS([ \(])/$1/;
|
||||||
|
s/PREFIX\(([^\)]*)\)/byte_$1/;
|
||||||
|
if (/^static [^\(]* ([^\s\(]+) *\(.*\)$/) {
|
||||||
|
$documented{$1} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(D);
|
||||||
|
|
||||||
|
# $out = join(' ', sort keys %documented);
|
||||||
|
# write;
|
||||||
|
# print "\n";
|
||||||
|
|
||||||
|
system "etags $srcdir/*.c $srcdir/../include/*.h";
|
||||||
|
open(TAGS, "TAGS");
|
||||||
|
while (<TAGS>) {
|
||||||
|
s/[\r\n]+$//;
|
||||||
|
if (/^\014$/) {
|
||||||
|
$filename = <TAGS>;
|
||||||
|
$filename =~ s/[\r\n]+$//;
|
||||||
|
$filename =~ s/,\d+$//;
|
||||||
|
$filename =~ s@.*[/\\]@@;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if ($filename =~ /\.c$/ ) {
|
||||||
|
next unless /^[_a-zA-Z]/;
|
||||||
|
} else {
|
||||||
|
next unless /^\# *define/;
|
||||||
|
s/\# *define *//;
|
||||||
|
}
|
||||||
|
next if $filename =~ /mpw\.c/;
|
||||||
|
|
||||||
|
s/ VPARAMS//;
|
||||||
|
s/ *\177.*//;
|
||||||
|
s/,$//;
|
||||||
|
s/DEFUN\(//;
|
||||||
|
s/\(//;
|
||||||
|
|
||||||
|
next if /^static /;
|
||||||
|
next if /\s/;
|
||||||
|
next if /^_/;
|
||||||
|
next if $documented{$_};
|
||||||
|
next if /_H_?$/;
|
||||||
|
|
||||||
|
if ($seen_in{$_} ne $filename) {
|
||||||
|
$saw{$_} ++;
|
||||||
|
}
|
||||||
|
$seen_in{$_} = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
for $k (keys %saw) {
|
||||||
|
delete $saw{$k} if $saw{$k} > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for $k (sort keys %saw) {
|
||||||
|
$fromfile{$seen_in{$k}} .= " " if $fromfile{$seen_in{$k}};
|
||||||
|
$fromfile{$seen_in{$k}} .= $k;
|
||||||
|
}
|
||||||
|
|
||||||
|
for $f (sort keys %fromfile) {
|
||||||
|
$out = "$f: $fromfile{$f}";
|
||||||
|
write;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -83,6 +83,17 @@ static const char vartmp[] =
|
||||||
|
|
||||||
static char *memoized_tmpdir;
|
static char *memoized_tmpdir;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Replacement char* choose_tmpdir ()
|
||||||
|
|
||||||
|
Returns a pointer to a directory path suitable for creating temporary
|
||||||
|
files in.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
choose_tmpdir ()
|
choose_tmpdir ()
|
||||||
{
|
{
|
||||||
|
@ -122,9 +133,17 @@ choose_tmpdir ()
|
||||||
return tmpdir;
|
return tmpdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a temporary file name (as a string) or NULL if unable to create
|
/*
|
||||||
one. SUFFIX is a suffix to append to the file name. The string is
|
|
||||||
malloced, and the temporary file has been created. */
|
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||||
|
|
||||||
|
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
|
||||||
|
string is malloced, and the temporary file has been created.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
char *
|
char *
|
||||||
make_temp_file (suffix)
|
make_temp_file (suffix)
|
||||||
|
|
|
@ -49,18 +49,27 @@ typedef unsigned long gcc_uint64_t;
|
||||||
#define TMP_MAX 16384
|
#define TMP_MAX 16384
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate a unique temporary file name from TEMPLATE.
|
/*
|
||||||
|
|
||||||
TEMPLATE has the form:
|
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||||
|
|
||||||
|
Generate a unique temporary file name from @var{template}.
|
||||||
|
@var{template} has the form:
|
||||||
|
|
||||||
|
@example
|
||||||
<path>/ccXXXXXX<suffix>
|
<path>/ccXXXXXX<suffix>
|
||||||
|
@end example
|
||||||
|
|
||||||
SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
|
@var{suffix_len} tells us how long <suffix> is (it can be zero
|
||||||
|
length). The last six characters of @var{template} before <suffix>
|
||||||
|
must be @code{XXXXXX}; they are replaced with a string that makes the
|
||||||
|
filename unique. Returns a file descriptor open on the file for
|
||||||
|
reading and writing.
|
||||||
|
|
||||||
The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
|
@end deftypefn
|
||||||
they are replaced with a string that makes the filename unique.
|
|
||||||
|
*/
|
||||||
|
|
||||||
Returns a file descriptor open on the file for reading and writing. */
|
|
||||||
int
|
int
|
||||||
mkstemps (template, suffix_len)
|
mkstemps (template, suffix_len)
|
||||||
char *template;
|
char *template;
|
||||||
|
|
|
@ -64,53 +64,66 @@ static char *install_error_msg = "installation problem, cannot exec `%s'";
|
||||||
|
|
||||||
/* pexecute: execute a program.
|
/* pexecute: execute a program.
|
||||||
|
|
||||||
PROGRAM and ARGV are the arguments to execv/execvp.
|
@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 flags)
|
||||||
|
|
||||||
THIS_PNAME is name of the calling program (i.e. argv[0]).
|
Executes a program.
|
||||||
|
|
||||||
TEMP_BASE is the path name, sans suffix, of a temporary file to use
|
@var{program} and @var{argv} are the arguments to
|
||||||
if needed. This is currently only needed for MSDOS ports that don't use
|
@code{execv}/@code{execvp}.
|
||||||
GO32 (do any still exist?). Ports that don't need it can pass NULL.
|
|
||||||
|
|
||||||
(FLAGS & PEXECUTE_SEARCH) is non-zero if $PATH should be searched
|
@var{this_pname} is name of the calling program (i.e. @code{argv[0]}).
|
||||||
(??? It's not clear that GCC passes this flag correctly).
|
|
||||||
(FLAGS & PEXECUTE_FIRST) is nonzero for the first process in chain.
|
|
||||||
(FLAGS & PEXECUTE_FIRST) is nonzero for the last process in chain.
|
|
||||||
FIRST_LAST could be simplified to only mark the last of a chain of processes
|
|
||||||
but that requires the caller to always mark the last one (and not give up
|
|
||||||
early if some error occurs). It's more robust to require the caller to
|
|
||||||
mark both ends of the chain.
|
|
||||||
|
|
||||||
The result is the pid on systems like Unix where we fork/exec and on systems
|
@var{temp_base} is the path name, sans suffix, of a temporary file to
|
||||||
like WIN32 and OS2 where we use spawn. It is up to the caller to wait for
|
use if needed. This is currently only needed for MS-DOS ports that
|
||||||
the child.
|
don't use @code{go32} (do any still exist?). Ports that don't need it
|
||||||
|
can pass @code{NULL}.
|
||||||
|
|
||||||
The result is the WEXITSTATUS on systems like MSDOS where we spawn and wait
|
(@var{flags} & @code{PEXECUTE_SEARCH}) is non-zero if @code{$PATH} should be searched
|
||||||
for the child here.
|
(??? It's not clear that GCC passes this flag correctly). (@var{flags} &
|
||||||
|
@code{PEXECUTE_FIRST}) is nonzero for the first process in chain.
|
||||||
|
(@var{flags} & @code{PEXECUTE_FIRST}) is nonzero for the last process
|
||||||
|
in chain. The first/last flags could be simplified to only mark the
|
||||||
|
last of a chain of processes but that requires the caller to always
|
||||||
|
mark the last one (and not give up early if some error occurs).
|
||||||
|
It's more robust to require the caller to mark both ends of the chain.
|
||||||
|
|
||||||
Upon failure, ERRMSG_FMT and ERRMSG_ARG are set to the text of the error
|
The result is the pid on systems like Unix where we
|
||||||
message with an optional argument (if not needed, ERRMSG_ARG is set to
|
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
|
||||||
NULL), and -1 is returned. `errno' is available to the caller to use.
|
use @code{spawn}. It is up to the caller to wait for the child.
|
||||||
|
|
||||||
pwait: cover function for wait.
|
The result is the WEXITSTATUS on systems like MS-DOS where we
|
||||||
|
@code{spawn} and wait for the child here.
|
||||||
|
|
||||||
PID is the process id of the task to wait for.
|
Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
|
||||||
STATUS is the `status' argument to wait.
|
text of the error message with an optional argument (if not needed,
|
||||||
FLAGS is currently unused (allows future enhancement without breaking
|
@var{errmsg_arg} is set to @code{NULL}), and -1 is returned.
|
||||||
upward compatibility). Pass 0 for now.
|
@code{errno} is available to the caller to use.
|
||||||
|
|
||||||
The result is the pid of the child reaped,
|
@end deftypefn
|
||||||
or -1 for failure (errno says why).
|
|
||||||
|
|
||||||
On systems that don't support waiting for a particular child, PID is
|
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
||||||
ignored. On systems like MSDOS that don't really multitask pwait
|
|
||||||
is just a mechanism to provide a consistent interface for the caller.
|
Waits for a program started by @code{pexecute} to finish.
|
||||||
|
|
||||||
|
@var{pid} is the process id of the task to wait for. @var{status} is
|
||||||
|
the `status' argument to wait. @var{flags} is currently unused (allows
|
||||||
|
future enhancement without breaking upward compatibility). Pass 0 for now.
|
||||||
|
|
||||||
|
The result is the pid of the child reaped, or -1 for failure
|
||||||
|
(@code{errno} says why).
|
||||||
|
|
||||||
|
On systems that don't support waiting for a particular child, @var{pid} is
|
||||||
|
ignored. On systems like MS-DOS that don't really multitask @code{pwait}
|
||||||
|
is just a mechanism to provide a consistent interface for the caller.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
@undocumented pfinish
|
||||||
|
|
||||||
pfinish: finish generation of script
|
pfinish: finish generation of script
|
||||||
|
|
||||||
pfinish is necessary for systems like MPW where a script is generated that
|
pfinish is necessary for systems like MPW where a script is generated that
|
||||||
runs the requested programs.
|
runs the requested programs. */
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __MSDOS__
|
#ifdef __MSDOS__
|
||||||
|
|
||||||
|
@ -254,7 +267,7 @@ extern int _spawnvp ();
|
||||||
/* This is a kludge to get around the Microsoft C spawn functions' propensity
|
/* This is a kludge to get around the Microsoft C spawn functions' propensity
|
||||||
to remove the outermost set of double quotes from all arguments. */
|
to remove the outermost set of double quotes from all arguments. */
|
||||||
|
|
||||||
const char * const *
|
static const char * const *
|
||||||
fix_argv (argvec)
|
fix_argv (argvec)
|
||||||
char **argvec;
|
char **argvec;
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,24 @@
|
||||||
* It was reworked for the GNU C Library by Roland McGrath.
|
* It was reworked for the GNU C Library by Roland McGrath.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Supplement {long int} random ()
|
||||||
|
@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* setstate (void *@var{arg_state})
|
||||||
|
|
||||||
|
Random number functions. @code{random} returns a random number in the
|
||||||
|
range @code{0..LONG_MAX}. @code{srandom} initializes the random
|
||||||
|
number generator to some starting point determined by @var{seed}
|
||||||
|
(else, the values returned by @code{random} are always the same for each
|
||||||
|
run of the program). @code{initstate} and @code{setstate} allow fine-grain
|
||||||
|
control over the state of the random number generator.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -19,21 +19,13 @@ Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension char* spaces (int @var{count})
|
||||||
|
|
||||||
spaces -- return a pointer to a buffer full of spaces
|
Returns a pointer to a memory region filled with the specified
|
||||||
|
number of spaces and null terminated. The returned pointer is
|
||||||
|
valid until at least the next call.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
char *spaces (int count)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Returns a pointer to a memory region filled with the specified
|
|
||||||
number of spaces and null terminated. The returned pointer is
|
|
||||||
valid until at least the next call.
|
|
||||||
|
|
||||||
BUGS
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -563,7 +563,7 @@ init_error_tables ()
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
||||||
@deftypefn Replacement 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
|
||||||
|
@ -599,7 +599,7 @@ errno_max ()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@deftypefn Replacement 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
|
||||||
|
@ -608,7 +608,7 @@ 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
|
||||||
|
@ -667,7 +667,7 @@ strerror (errnoval)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@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
|
||||||
|
@ -675,7 +675,7 @@ 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
|
||||||
|
@ -727,7 +727,7 @@ strerrno (errnoval)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@deftypefn Replacement 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.
|
||||||
|
|
|
@ -350,28 +350,22 @@ init_signal_tables ()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension int signo_max ()
|
||||||
|
|
||||||
signo_max -- return the max signo value
|
Returns the maximum signal value for which a corresponding symbolic
|
||||||
|
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
|
||||||
|
be more symbolic names than messages, or vice versa. In fact, the
|
||||||
|
manual page for @code{psignal(3b)} explicitly warns that one should
|
||||||
|
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
|
||||||
|
the table. Thus @code{NSIG} might be smaller than value implied by
|
||||||
|
the largest signo value defined in @code{<signal.h>}.
|
||||||
|
|
||||||
SYNOPSIS
|
We return the maximum value that can be used to obtain a meaningful
|
||||||
|
symbolic name or message.
|
||||||
|
|
||||||
int signo_max ();
|
@end deftypefn
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Returns the maximum signo value for which a corresponding symbolic
|
|
||||||
name or message is available. Note that in the case where
|
|
||||||
we use the sys_siglist supplied by the system, it is possible for
|
|
||||||
there to be more symbolic names than messages, or vice versa.
|
|
||||||
In fact, the manual page for psignal(3b) explicitly warns that one
|
|
||||||
should check the size of the table (NSIG) before indexing it,
|
|
||||||
since new signal codes may be added to the system before they are
|
|
||||||
added to the table. Thus NSIG might be smaller than value
|
|
||||||
implied by the largest signo value defined in <signal.h>.
|
|
||||||
|
|
||||||
We return the maximum value that can be used to obtain a meaningful
|
|
||||||
symbolic name or message.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -391,31 +385,25 @@ signo_max ()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
||||||
|
|
||||||
strsignal -- map a signal number to a signal message string
|
Maps an signal number to an signal message string, the contents of
|
||||||
|
which are implementation defined. On systems which have the external
|
||||||
|
variable @code{sys_siglist}, these strings will be the same as the
|
||||||
|
ones used by @code{psignal()}.
|
||||||
|
|
||||||
SYNOPSIS
|
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
|
||||||
|
signal number, then returns the string @samp{Signal @var{num}}, where
|
||||||
|
@var{num} is the signal number.
|
||||||
|
|
||||||
const char *strsignal (int signo)
|
If the supplied signal number is not a valid index into
|
||||||
|
@code{sys_siglist}, returns @code{NULL}.
|
||||||
|
|
||||||
DESCRIPTION
|
The returned string is only guaranteed to be valid only until the next
|
||||||
|
call to @code{strsignal}.
|
||||||
|
|
||||||
Maps an signal number to an signal message string, the contents of
|
@end deftypefn
|
||||||
which are implementation defined. On systems which have the external
|
|
||||||
variable sys_siglist, these strings will be the same as the ones used
|
|
||||||
by psignal().
|
|
||||||
|
|
||||||
If the supplied signal number is within the valid range of indices
|
|
||||||
for the sys_siglist, but no message is available for the particular
|
|
||||||
signal number, then returns the string "Signal NUM", where NUM is the
|
|
||||||
signal number.
|
|
||||||
|
|
||||||
If the supplied signal number is not a valid index into sys_siglist,
|
|
||||||
returns NULL.
|
|
||||||
|
|
||||||
The returned string is only guaranteed to be valid only until the
|
|
||||||
next call to strsignal.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -461,31 +449,23 @@ strsignal (signo)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
||||||
|
|
||||||
strsigno -- map an signal number to a symbolic name string
|
Given an signal number, returns a pointer to a string containing the
|
||||||
|
symbolic name of that signal number, as found in @code{<signal.h>}.
|
||||||
|
|
||||||
SYNOPSIS
|
If the supplied signal number is within the valid range of indices for
|
||||||
|
symbolic names, but no name is available for the particular signal
|
||||||
|
number, then returns the string @samp{Signal @var{num}}, where
|
||||||
|
@var{num} is the signal number.
|
||||||
|
|
||||||
const char *strsigno (int signo)
|
If the supplied signal number is not within the range of valid
|
||||||
|
indices, then returns @code{NULL}.
|
||||||
|
|
||||||
DESCRIPTION
|
The contents of the location pointed to are only guaranteed to be
|
||||||
|
valid until the next call to @code{strsigno}.
|
||||||
|
|
||||||
Given an signal number, returns a pointer to a string containing
|
@end deftypefn
|
||||||
the symbolic name of that signal number, as found in <signal.h>.
|
|
||||||
|
|
||||||
If the supplied signal number is within the valid range of indices
|
|
||||||
for symbolic names, but no name is available for the particular
|
|
||||||
signal number, then returns the string "Signal NUM", where NUM is
|
|
||||||
the signal number.
|
|
||||||
|
|
||||||
If the supplied signal number is not within the range of valid
|
|
||||||
indices, then returns NULL.
|
|
||||||
|
|
||||||
BUGS
|
|
||||||
|
|
||||||
The contents of the location pointed to are only guaranteed to be
|
|
||||||
valid until the next call to strsigno.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -524,18 +504,12 @@ strsigno (signo)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Extension int strtosigno (const char *@var{name})
|
||||||
|
|
||||||
strtosigno -- map a symbolic signal name to a numeric value
|
Given the symbolic name of a signal, map it to a signal number. If no
|
||||||
|
translation is found, returns 0.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
int strtosigno (char *name)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Given the symbolic name of a signal, map it to a signal number.
|
|
||||||
If no translation is found, returns 0.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -570,19 +544,14 @@ strtosigno (name)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
NAME
|
@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
|
||||||
|
|
||||||
psignal -- print message about signal to stderr
|
Print @var{message} to the standard error, followed by a colon,
|
||||||
|
followed by the description of the signal specified by @var{signo},
|
||||||
|
followed by a newline.
|
||||||
|
|
||||||
SYNOPSIS
|
@end deftypefn
|
||||||
|
|
||||||
void psignal (unsigned signo, char *message);
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Print to the standard error the message, followed by a colon,
|
|
||||||
followed by the description of the signal specified by signo,
|
|
||||||
followed by a newline.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HAVE_PSIGNAL
|
#ifndef HAVE_PSIGNAL
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@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})
|
||||||
|
|
||||||
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
|
||||||
|
@ -39,7 +40,8 @@ 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.
|
@code{strtod} above. The @code{strtoul} function is the same, except
|
||||||
|
that the converted value is unsigned.
|
||||||
|
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,21 @@ extern PTR malloc ();
|
||||||
int global_total_width;
|
int global_total_width;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@deftypefn Extension int vasprintf (char **@var{resptr}, char *@var{format}, va_list @var{args})
|
||||||
|
|
||||||
|
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
|
||||||
|
of the buffer needed, allocate memory with @code{malloc}, and store a
|
||||||
|
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||||
|
returned is the same as @code{vsprintf} would return. If memory could
|
||||||
|
not be allocated, zero is returned and @code{NULL} is stored in
|
||||||
|
@code{*@var{resptr}}.
|
||||||
|
|
||||||
|
@end deftypefn
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
static int int_vasprintf PARAMS ((char **, const char *, va_list *));
|
static int int_vasprintf PARAMS ((char **, const char *, va_list *));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue