--- ray/src/meta/sort.c 2003/06/10 14:26:03 1.3 +++ ray/src/meta/sort.c 2003/07/14 20:02:29 1.6 @@ -1,18 +1,15 @@ #ifndef lint -static const char RCSid[] = "$Id: sort.c,v 1.3 2003/06/10 14:26:03 schorsch Exp $"; +static const char RCSid[] = "$Id: sort.c,v 1.6 2003/07/14 20:02:29 schorsch Exp $"; #endif /* * Sorting routines for meta-files */ -#include "paths.h" +#include "rtprocess.h" /* getpid() */ +#include "rterror.h" #include "meta.h" -#ifdef _WIN32 - #include /* getpid() */ -#endif - #define PBSIZE 1000 /* max size of sort block */ /* maxalloc must be >= this */ @@ -83,7 +80,7 @@ int (*pcmp)() /* compares pointers to pointers to pr */ void -mergesort( /* merge sorted files with list */ +pmergesort( /* merge sorted files with list */ FILE *fi[], /* array of input files */ int nf, /* number of input files */ @@ -105,7 +102,7 @@ FILE *ofp /* output file */ for (i = 0; i < nf; i++) { /* initialize input files */ if ((pp[i] = palloc()) == NULL) - error(SYSTEM, "memory exhausted in mergesort"); + error(SYSTEM, "memory exhausted in pmergesort"); readp(pp[i], fi[i]); } @@ -167,7 +164,7 @@ FILE *ofp if ((fp = ofp) == NULL) fp = efopen(tfname(height + 1, nt), "w"); - mergesort(fi, nf, pl, pcmp, fp); + pmergesort(fi, nf, pl, pcmp, fp); for (i = 0; i < nf; i++) { fclose(fi[i]); @@ -286,7 +283,7 @@ int lvl, int num temp_directory(pathbuf, sizeof(pathbuf)); psiz = strlen(pathbuf); } - snprintf(fnbuf, sizeof(pathbuf, psiz), + snprintf(fnbuf, sizeof(pathbuf)-psiz, "%s/S%d%c%d", pathbuf, getpid(), lvl+'A', num); /*sprintf(fnbuf, "%sS%d%c%d", TDIR, getpid(), lvl+'A', num);*/