828
|
1 /* Copyright (C) 1991, 1993 Free Software Foundation, Inc. |
|
2 This file is part of the GNU C Library. |
|
3 |
|
4 The GNU C Library is free software; you can redistribute it and/or |
|
5 modify it under the terms of the GNU General Public License as |
|
6 published by the Free Software Foundation; either version 2 of the |
|
7 License, or (at your option) any later version. |
|
8 |
|
9 The GNU C Library is distributed in the hope that it will be useful, |
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 General Public License for more details. |
|
13 |
|
14 You should have received a copy of the GNU General Public |
|
15 License along with the GNU C Library; see the file COPYING. If |
|
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave, |
|
17 Cambridge, MA 02139, USA. */ |
|
18 |
|
19 #ifdef HAVE_CONFIG_H |
1243
|
20 #include <config.h> |
828
|
21 #endif |
|
22 |
1047
|
23 #ifndef HAVE_TMPNAM |
828
|
24 |
|
25 #include <stddef.h> |
|
26 #include <stdio.h> |
|
27 #include <string.h> |
|
28 |
|
29 extern char *__stdio_gen_tempname (const char *dir, const char *pfx, |
|
30 int dir_search, size_t *lenptr, |
|
31 FILE **streamptr); |
|
32 |
|
33 /* Generate a unique filename in P_tmpdir. */ |
|
34 char * |
|
35 tmpnam (register char *s) |
|
36 { |
|
37 register char *t = __stdio_gen_tempname((const char *) NULL, |
|
38 (const char *) NULL, 0, |
|
39 (size_t *) NULL, (FILE **) NULL); |
|
40 |
|
41 if (t == NULL) |
|
42 return NULL; |
|
43 |
|
44 if (s != NULL) |
|
45 (void) strcpy(s, t); |
|
46 else |
|
47 s = t; |
|
48 |
|
49 return s; |
|
50 } |
|
51 |
|
52 #endif |