configure.in (MAKEINFO, PERL): Detect these.
* configure.in (MAKEINFO, PERL): Detect these.
(--enable-maintainer-mode): Add.
* configure: Regenerate.
* Makefile.in (MAKEINFO, PERL): Define.
(libiberty.info, libiberty.dvi, libiberty.html): New.
(CFILES): Add bsearch.c.
(CONFIGURED_OFILES): New, list of objects configure might add.
(maint-missing, maint-buildall): New, for maintainers only.
(clean, mostlyclean): Add info/dvi/html files.
* libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
* gather-docs: New, for maintainers.
* maint-tool: New, for maintainers.
* alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
documentation.
Co-Authored-By: Phil Edwards <pedwards@disaster.jaj.com>
From-SVN: r45828
2001-09-26 20:16:17 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
@deftypefn Supplemental char* tmpnam (char *@var{s})
|
|
|
|
|
|
|
|
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
|
|
|
|
it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
|
alloca.c, [...]: Improve manual formatting.
* alloca.c, clock.c, getcwd.c, getpagesize.c, getpwd.c, index.c,
libiberty.texi, memchr.c, putenv.c, rindex.c, strchr.c, strdup.c,
strerror.c, strrchr.c, strstr.c, strtod.c, tmpnam.c, vfork.c,
xatexit.c, xmalloc.c, xstrerror.c: Improve manual formatting. Fix
spelling. Give names to function arguments in documentation. Use
(void) prototypes in documentation.
* functions.texi: Regenerate.
From-SVN: r46068
2001-10-07 23:53:31 +02:00
|
|
|
or be @code{NULL}. Use of this function creates a security risk, and it must
|
configure.in (MAKEINFO, PERL): Detect these.
* configure.in (MAKEINFO, PERL): Detect these.
(--enable-maintainer-mode): Add.
* configure: Regenerate.
* Makefile.in (MAKEINFO, PERL): Define.
(libiberty.info, libiberty.dvi, libiberty.html): New.
(CFILES): Add bsearch.c.
(CONFIGURED_OFILES): New, list of objects configure might add.
(maint-missing, maint-buildall): New, for maintainers only.
(clean, mostlyclean): Add info/dvi/html files.
* libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
* gather-docs: New, for maintainers.
* maint-tool: New, for maintainers.
* alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
documentation.
Co-Authored-By: Phil Edwards <pedwards@disaster.jaj.com>
From-SVN: r45828
2001-09-26 20:16:17 +02:00
|
|
|
not be used in new projects. Use @code{mkstemp} instead.
|
|
|
|
|
|
|
|
@end deftypefn
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifndef L_tmpnam
|
1999-05-13 03:23:42 +02:00
|
|
|
#define L_tmpnam 100
|
1997-08-22 00:57:35 +02:00
|
|
|
#endif
|
|
|
|
#ifndef P_tmpdir
|
|
|
|
#define P_tmpdir "/usr/tmp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static char tmpnam_buffer[L_tmpnam];
|
|
|
|
static int tmpnam_counter;
|
|
|
|
|
|
|
|
extern int getpid ();
|
|
|
|
|
|
|
|
char *
|
|
|
|
tmpnam (s)
|
|
|
|
char *s;
|
|
|
|
{
|
|
|
|
int pid = getpid ();
|
|
|
|
|
|
|
|
if (s == NULL)
|
|
|
|
s = tmpnam_buffer;
|
|
|
|
|
|
|
|
/* Generate the filename and make sure that there isn't one called
|
|
|
|
it already. */
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
sprintf (s, "%s/%s%x.%x", P_tmpdir, "t", pid, tmpnam_counter);
|
|
|
|
f = fopen (s, "r");
|
|
|
|
if (f == NULL)
|
|
|
|
break;
|
|
|
|
tmpnam_counter++;
|
|
|
|
fclose (f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|