diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-15 23:12:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-15 23:12:49 +0300 |
commit | 3697ec5ca140f686643d204a54181a5ddbf9a799 (patch) | |
tree | 592873e8614475012ddd5f4e6d0482acadbfc9e2 /missing.d/tmpnam.c | |
parent | f3d9dd233ac07f764a554528c85be3768a1d1ddb (diff) | |
download | egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.tar.gz egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.tar.bz2 egawk-3697ec5ca140f686643d204a54181a5ddbf9a799.zip |
Moved to gawk 2.11.
Diffstat (limited to 'missing.d/tmpnam.c')
-rw-r--r-- | missing.d/tmpnam.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/missing.d/tmpnam.c b/missing.d/tmpnam.c new file mode 100644 index 00000000..8f49859a --- /dev/null +++ b/missing.d/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; + } +} |