Lines Matching defs:tmp

56  * / as first pfx char provides tmp file generation control
60 * automatic (default) cycled with each tmp file
81 #define TMP1 "/tmp"
82 #define TMP2 "/usr/tmp"
99 } tmp = { S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH };
125 tmp.manual = 1;
126 if (tmp.dir && !*tmp.dir++)
127 tmp.dir = tmp.vec;
130 tmp.manual = streq(dir, "manual");
135 if (tmp.pfx)
136 free(tmp.pfx);
137 tmp.pfx = dir ? strdup(dir) : (char*)0;
142 tmp.mode = S_IRUSR|S_IWUSR;
147 tmp.mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
152 tmp.key = (tmp.seed = (tmp.rng = dir ? (uint32_t)strtoul(dir, NiL, 0) : (uint32_t)1) != 0)? (uint32_t)0x63c63cd9L : 0;
157 if (tmp.vec)
159 free(tmp.vec);
160 tmp.vec = 0;
162 if (tmp.tmpdir)
163 free(tmp.tmpdir);
164 tmp.tmpdir = dir ? strdup(dir) : (char*)0;
169 if (tmp.vec)
171 free(tmp.vec);
172 tmp.vec = 0;
174 if (tmp.tmppath)
175 free(tmp.tmppath);
176 tmp.tmppath = dir ? strdup(dir) : (char*)0;
181 if (tmp.seed)
187 if (!tmp.vec)
189 if ((x = tmp.tmppath) || (x = getenv(TMP_PATH_ENV)))
198 if (!(tmp.vec = newof(0, char*, n, strlen(x) + 1)))
200 tmp.dir = tmp.vec;
201 x = strcpy((char*)(tmp.dir + n), x);
202 *tmp.dir++ = x;
206 if (!VALID(*(tmp.dir - 1)))
207 tmp.dir--;
208 *tmp.dir++ = x;
210 if (!VALID(*(tmp.dir - 1)))
211 tmp.dir--;
212 *tmp.dir = 0;
216 if (((d = tmp.tmpdir) || (d = getenv(TMP_ENV))) && !VALID(d))
218 if (!(tmp.vec = newof(0, char*, 2, d ? (strlen(d) + 1) : 0)))
221 *tmp.vec = strcpy((char*)(tmp.vec + 2), d);
223 tmp.dir = tmp.vec;
225 if (!(d = *tmp.dir++))
227 tmp.dir = tmp.vec;
228 d = *tmp.dir++;
239 if (!pfx && !(pfx = tmp.pfx))
291 if (!tmp.rng || !tmp.seed && (attempt || tmp.pid != getpid()))
299 tmp.pid = getpid();
300 tmp.rng = (uintptr_t)tmp.pid * ((uintptr_t)time(NiL) ^ (((uintptr_t)(&attempt)) >> 3) ^ (((uintptr_t)tmp.dir) >> 3));
301 if (!tmp.key)
302 tmp.key = (tmp.rng >> 16) | ((tmp.rng & 0xffff) << 16);
303 tmp.rng ^= tmp.key;
309 if ((r = (tmp.rng - 1) & 03))
310 tmp.rng += 4 - r;
317 key = tmp.rng * tmp.key + tv.tv_nsec;
318 if (!tmp.seed)
320 tmp.key = tmp.rng * key + tv.tv_nsec;
321 sfsprintf(keybuf, sizeof(keybuf), "%07.7.32I*u%07.7.32I*u", sizeof(key), key, sizeof(tmp.key), tmp.key);
325 if ((n = open(b, O_CREAT|O_RDWR|O_EXCL|O_TEMPORARY, tmp.mode)) >= 0)