* Copyright (c) 1988 Regents of the University of California.
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)tempnam.c 4.8 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#define P_tmpdir "/usr/tmp"
if (!(f
= tmpnam((char *)NULL
)) || !(fp
= fopen(f
, "w+"))) {
fprintf(stderr
, "tmpfile: cannot open %s.\n", f
);
char *malloc(), *mktemp();
if (!s
&& !(s
= malloc((u_int
)MAXPATHLEN
)))
(void)sprintf(s
, "%s/XXXXXX", P_tmpdir
);
char *f
, *name
, *getenv(), *malloc(), *mktemp();
if (!(name
= malloc((u_int
)MAXPATHLEN
)))
if (f
= getenv("TMPDIR")) {
(void)sprintf(name
, "%s/%sXXXXXX", f
, pfx
? "" : pfx
);
(void)sprintf(name
, "%s/%sXXXXXX", dir
, pfx
? "" : pfx
);
(void)sprintf(name
, "%s/%sXXXXXX", P_tmpdir
, pfx
? "" : pfx
);
(void)sprintf(name
, "/tmp/%sXXXXXX", pfx
? "" : pfx
);