38#define LONG_BIT (CHAR_BIT * 4)
41#define L_tmpmin (lengthof_tmp + 5)
43#if (L_tmpnam > L_tmpmin)
44#if (L_tmpnam > L_tmpmin + LONG_BIT / 6)
45#define TMP_MAX ULONG_MAX
47#define TMP_MAX ((1L << (6 * (L_tmpnam - L_tmpmin))) - 1)
51#error "tmpnam: L_tmpnam undefined"
53#error "tmpnam: L_tmpnam too small"
60 static const char digits[] =
61#if (L_tmpnam >= L_tmpmin + LONG_BIT / 4)
65 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
68 static unsigned long lastcount = 0;
69 static char buffer[L_tmpnam + 1];
71 unsigned long count = lastcount;
78 register int i = L_tmpnam;
79 register unsigned long c;
80 register unsigned int p;
86 c = (count == TMP_MAX) ? 0 : ++count;
94 *--s = digits[p % 10];
103 if (access(s, 0) != 0)
107 if (count == lastcount) {
char * tempnam(const char *dir, const char *pfx)
static char * _tmpnam(void)