Penguin
Annotated edit history of tempnam(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 TEMPNAM
2 !!!TEMPNAM
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 ERRORS
8 NOTES
9 BUGS
10 CONFORMING TO
11 SEE ALSO
12 ----
13 !!NAME
14
15
16 tempnam - create a name for a temporary file
17 !!SYNOPSIS
18
19
20 __#include
21 __''dir''__, const char *__''pfx''__);
22 __
23 !!DESCRIPTION
24
25
26 The __tempnam()__ function returns a pointer to a string
27 that is a valid filename, and such that a file with this
28 name did not exist when __tempnam()__ checked. The
29 filename suffix of the pathname generated will start with
30 ''pfx'' in case ''pfx'' is a non-NULL string of at
31 most five bytes. The directory prefix part of the pathname
32 generated is required to be `appropriate' (often that at
33 least implies writable). Attempts to find an appropriate
34 directory go through the following steps: (i) In case the
35 environment variable TMPDIR exists and contains the name of
36 an appropriate directory, that is used. (ii) Otherwise, if
37 the ''dir'' argument is non-NULL and appropriate, it is
38 used. (iii) Otherwise, P_tmpdir (as defined in
39 '''') is used when appropriate. (iv)
40 Finally an implementation-defined directory may be
41 used.
42 !!RETURN VALUE
43
44
45 The __tempnam()__ function returns a pointer to a unique
46 temporary filename, or NULL if a unique name cannot be
47 generated.
48 !!ERRORS
49
50
51 __ENOMEM__
52
53
54 Allocation of storage failed.
55 !!NOTES
56
57
58 SUSv2 does not mention the use of TMPDIR; glibc will use it
59 only when the program is not suid. SVID2 specifies that the
60 directory used under (iv) is ''/tmp''. SVID2 specifies
61 that the string returned by __tempnam()__ was allocated
62 using malloc(3) and hence can be freed by
63 free(3).
64
65
66 The __tempnam()__ function generates a different string
67 each time it is called, up to TMP_MAX (defined in
68 '''') times. If it is called more than
69 TMP_MAX times, the behaviour is implementation
70 defined.
71
72
73 In case the ''pfx'' argument has length larger than five,
74 glibc will use the first five bytes. Upon failure to find a
75 unique name, glibc will return EEXIST.
76 !!BUGS
77
78
79 The precise meaning of `appropriate' is undefined; it is
80 unspecified how accessibility of a directory is determined.
81 Never use this function. Use tmpfile(3)
82 instead.
83 !!CONFORMING TO
84
85
86 SVID 2, BSD 4.3
87 !!SEE ALSO
88
89
90 mktemp(3), mkstemp(3), tmpfile(3),
91 tmpnam(3)
92 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.