From 765c7494b3dac62207e6cd57fb839997e237f292 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 11:58:26 +0300 Subject: Moving to 2.13.2. --- missing/tmpnam.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 missing/tmpnam.c (limited to 'missing/tmpnam.c') diff --git a/missing/tmpnam.c b/missing/tmpnam.c new file mode 100644 index 00000000..8f49859a --- /dev/null +++ b/missing/tmpnam.c @@ -0,0 +1,27 @@ +/* + * tmpnam - an implementation for systems lacking a library version + * this version does not rely on the P_tmpdir and L_tmpnam constants. + */ + +#ifndef NULL +#define NULL 0 +#endif + +static char template[] = "/tmp/gawkXXXXXX"; + +char * +tmpnam(tmp) +char *tmp; +{ + static char tmpbuf[sizeof(template)]; + + if (tmp == NULL) { + (void) strcpy(tmpbuf, template); + (void) mktemp(tmpbuf); + return tmpbuf; + } else { + (void) strcpy(tmp, template); + (void) mktemp(tmp); + return tmp; + } +} -- cgit v1.2.3