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;
|
|
|
|
|
ternary.h: Don't use PARAMS anymore.
include/
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
* ternary.h: Don't use PARAMS anymore.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 6/n.
* strerror.c (init_error_tables, errno_max, strerror,
strerrno,
strtoerrno, main): Use ISO C prototype style.
* strncasecmp.c (strncasecmp): Likewise.
* strncmp.c (strncmp): Likewise.
* strndup.c (strndup): Likewise.
* strrchr.c (strrchr): Likewise.
* strsignal.c (init_signal_tables, signo_max, strsignal,
strsigno, strtosigno, psignal, main): Likewise.
* strstr.c (strstr): Likewise.
* strtod.c (strtod, atof): Likewise.
* strtol.c (strtol): Likewise.
* strtoul.c (strtoul): Likewise.
* ternary.c (ternary_insert, ternary_cleanup, ternary_search,
ternary_recursivesearch): Likewise.
* tmpnam.c (tmpnam): Likewise.
* unlink-if-ordinary.c (unlink_if_ordinary): Likewise.
* vasprintf.c (int_vasprintf, vasprintf, checkit, main):
Likewise.
* vfork.c (vfork): Likewise.
* vfprintf.c (vfprintf): Likewise.
* vprintf.c (vprintf): Likewise.
* vsnprintf.c (vsnprintf, checkit, main): Likewise.
* vsprintf.c (vsprintf): Likewise.
* waitpid.c (waitpid): Likewise.
* xatexit.c (xatexit, xatexit_cleanup): Likewise.
* xexit.c (xexit): Likewise.
* xmalloc.c (xmalloc_set_program_name, xmalloc_failed,
xmalloc,
xcalloc, xrealloc): Likewise.
* xmemdup.c (xmemdup): Likewise.
* xstrdup.c (xstrdup): Likewise.
* xstrerror.c (xstrerror): Likewise.
* xstrndup.c (xstrndup): Likewise.
From-SVN: r97122
2005-03-28 03:28:01 +02:00
|
|
|
extern int getpid (void);
|
1997-08-22 00:57:35 +02:00
|
|
|
|
|
|
|
char *
|
ternary.h: Don't use PARAMS anymore.
include/
2005-03-27 Gabriel Dos Reis <gdr@integreable-solutions.net>
* ternary.h: Don't use PARAMS anymore.
libiberty/
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert libiberty to use ISO C prototype style 6/n.
* strerror.c (init_error_tables, errno_max, strerror,
strerrno,
strtoerrno, main): Use ISO C prototype style.
* strncasecmp.c (strncasecmp): Likewise.
* strncmp.c (strncmp): Likewise.
* strndup.c (strndup): Likewise.
* strrchr.c (strrchr): Likewise.
* strsignal.c (init_signal_tables, signo_max, strsignal,
strsigno, strtosigno, psignal, main): Likewise.
* strstr.c (strstr): Likewise.
* strtod.c (strtod, atof): Likewise.
* strtol.c (strtol): Likewise.
* strtoul.c (strtoul): Likewise.
* ternary.c (ternary_insert, ternary_cleanup, ternary_search,
ternary_recursivesearch): Likewise.
* tmpnam.c (tmpnam): Likewise.
* unlink-if-ordinary.c (unlink_if_ordinary): Likewise.
* vasprintf.c (int_vasprintf, vasprintf, checkit, main):
Likewise.
* vfork.c (vfork): Likewise.
* vfprintf.c (vfprintf): Likewise.
* vprintf.c (vprintf): Likewise.
* vsnprintf.c (vsnprintf, checkit, main): Likewise.
* vsprintf.c (vsprintf): Likewise.
* waitpid.c (waitpid): Likewise.
* xatexit.c (xatexit, xatexit_cleanup): Likewise.
* xexit.c (xexit): Likewise.
* xmalloc.c (xmalloc_set_program_name, xmalloc_failed,
xmalloc,
xcalloc, xrealloc): Likewise.
* xmemdup.c (xmemdup): Likewise.
* xstrdup.c (xstrdup): Likewise.
* xstrerror.c (xstrerror): Likewise.
* xstrndup.c (xstrndup): Likewise.
From-SVN: r97122
2005-03-28 03:28:01 +02:00
|
|
|
tmpnam (char *s)
|
1997-08-22 00:57:35 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|