os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/tmpnam.c
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/compat/tmpnam.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,42 @@
1.4 +/*
1.5 + * Copyright (c) 1988 Regents of the University of California.
1.6 + * All rights reserved.
1.7 + *
1.8 + * Redistribution and use in source and binary forms are permitted
1.9 + * provided that this notice is preserved and that due credit is given
1.10 + * to the University of California at Berkeley. The name of the University
1.11 + * may not be used to endorse or promote products derived from this
1.12 + * software without specific written prior permission. This software
1.13 + * is provided ``as is'' without express or implied warranty.
1.14 + *
1.15 + * RCS: @(#) $Id: tmpnam.c,v 1.2 1998/09/14 18:39:45 stanton Exp $
1.16 + */
1.17 +
1.18 +#include <sys/param.h>
1.19 +#include <sys/stat.h>
1.20 +#include <sys/file.h>
1.21 +#include <stdio.h>
1.22 +
1.23 +/*
1.24 + * Use /tmp instead of /usr/tmp, because L_tmpname is only 14 chars
1.25 + * on some machines (like NeXT machines) and /usr/tmp will cause
1.26 + * buffer overflows.
1.27 + */
1.28 +
1.29 +#ifdef P_tmpdir
1.30 +# undef P_tmpdir
1.31 +#endif
1.32 +#define P_tmpdir "/tmp"
1.33 +
1.34 +char *
1.35 +tmpnam(s)
1.36 + char *s;
1.37 +{
1.38 + static char name[50];
1.39 + char *mktemp();
1.40 +
1.41 + if (!s)
1.42 + s = name;
1.43 + (void)sprintf(s, "%s/XXXXXX", P_tmpdir);
1.44 + return(mktemp(s));
1.45 +}