8 |
|
#include "paths.h" |
9 |
|
#include "meta.h" |
10 |
|
|
11 |
+ |
#ifdef _WIN32 |
12 |
+ |
#include <process.h> /* getpid() */ |
13 |
+ |
#endif |
14 |
|
|
15 |
+ |
|
16 |
|
#define PBSIZE 1000 /* max size of sort block */ |
17 |
|
/* maxalloc must be >= this */ |
18 |
|
|
156 |
|
FILE *ofp |
157 |
|
) |
158 |
|
{ |
155 |
– |
char *tfname(); |
159 |
|
FILE *fi[NFILES], *fp; |
160 |
|
int i; |
161 |
|
|
279 |
|
) |
280 |
|
{ |
281 |
|
static char pathbuf[PATH_MAX]; |
282 |
< |
static char fnbuf[32]; |
282 |
> |
static char fnbuf[PATH_MAX]; |
283 |
> |
static size_t psiz; |
284 |
|
|
285 |
+ |
if (pathbuf[0] == '\0') { /* first time */ |
286 |
+ |
temp_directory(pathbuf, sizeof(pathbuf)); |
287 |
+ |
psiz = strlen(pathbuf); |
288 |
+ |
} |
289 |
+ |
snprintf(fnbuf, sizeof(pathbuf, psiz), |
290 |
+ |
"%s/S%d%c%d", pathbuf, getpid(), lvl+'A', num); |
291 |
|
/*sprintf(fnbuf, "%sS%d%c%d", TDIR, getpid(), lvl+'A', num);*/ |
282 |
– |
sprintf(fnbuf, "%c%d_XXXXXX", lvl+'A', num); |
283 |
– |
temp_filename(pathbuf, sizeof(pathbuf), fnbuf); |
292 |
|
|
293 |
< |
/*return(fnbuf);*/ |
286 |
< |
return pathbuf; |
293 |
> |
return(fnbuf); |
294 |
|
} |