--- ray/src/hd/rhoptimize.c 2004/01/01 11:21:55 3.18 +++ ray/src/hd/rhoptimize.c 2018/10/05 19:19:16 3.22 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rhoptimize.c,v 3.18 2004/01/01 11:21:55 schorsch Exp $"; +static const char RCSid[] = "$Id: rhoptimize.c,v 3.22 2018/10/05 19:19:16 greg Exp $"; #endif /* * Optimize holodeck for quick access. @@ -40,7 +40,7 @@ main( { char *inpname, *outname; int hdfd[2]; - long nextipos, lastopos, thisopos; + off_t nextipos, lastopos, thisopos; progname = argv[0]; argv++; argc--; /* duplicate checking flag? */ @@ -72,20 +72,20 @@ main( } /* copy holodeck file header */ nextipos = rhinitcopy(hdfd, inpname, outname); - lastopos = 0L; /* copy sections one by one */ + lastopos = 0; /* copy sections one by one */ while (nextipos != 0L) { /* set input position; get next */ - lseek(hdfd[0], (off_t)nextipos, SEEK_SET); + lseek(hdfd[0], nextipos, SEEK_SET); read(hdfd[0], (char *)&nextipos, sizeof(nextipos)); /* get output position; set last */ thisopos = lseek(hdfd[1], (off_t)0, SEEK_END); - if (lastopos > 0L) { - lseek(hdfd[1], (off_t)lastopos, SEEK_SET); + if (lastopos > 0) { + lseek(hdfd[1], lastopos, SEEK_SET); write(hdfd[1], (char *)&thisopos, sizeof(thisopos)); lseek(hdfd[1], (off_t)0, SEEK_END); } lastopos = thisopos; - thisopos = 0L; /* write place holder */ + thisopos = 0; /* write place holder */ write(hdfd[1], (char *)&thisopos, sizeof(thisopos)); /* copy holodeck section */ copysect(hdfd[0], hdfd[1]); @@ -98,7 +98,7 @@ main( outname, inpname); error(SYSTEM, errmsg); } - return 0; + return(0); } @@ -125,9 +125,15 @@ rhinitcopy( /* open files and copy header */ error(SYSTEM, errmsg); } /* set up signal handling */ +#ifdef SIGINT if (signal(SIGINT, quit) == SIG_IGN) signal(SIGINT, SIG_IGN); +#endif +#ifdef SIGHUP if (signal(SIGHUP, quit) == SIG_IGN) signal(SIGHUP, SIG_IGN); +#endif +#ifdef SIGTERM if (signal(SIGTERM, quit) == SIG_IGN) signal(SIGTERM, SIG_IGN); +#endif #ifdef SIGXCPU if (signal(SIGXCPU, quit) == SIG_IGN) signal(SIGXCPU, SIG_IGN); if (signal(SIGXFSZ, quit) == SIG_IGN) signal(SIGXFSZ, SIG_IGN); @@ -156,11 +162,11 @@ rhinitcopy( /* open files and copy header */ static int nuniq( /* sort unique rays to front of beam list */ - register RAYVAL *rva, + RAYVAL *rva, int n ) { - register int i, j; + int i, j; RAYVAL rtmp; for (j = 0; j < n; j++) @@ -188,7 +194,7 @@ bpcmp( /* compare beam positions on disk */ const void *b2p ) { - register off_t pdif = beamdir[*(int*)b1p].fo - beamdir[*(int*)b2p].fo; + off_t pdif = beamdir[*(int*)b1p].fo - beamdir[*(int*)b2p].fo; if (pdif < 0L) return(-1); return(pdif > 0L); @@ -203,8 +209,8 @@ xferclump( /* transfer the given clump to hout and fr int nb ) { - register int i; - register BEAM *bp; + int i; + BEAM *bp; int n; beamdir = hp->bi; /* sort based on file position */ @@ -243,7 +249,7 @@ copysect( /* copy holodeck section from ifd to ofd */ void eputs(s) /* put error message to stderr */ -register char *s; +char *s; { static int midline = 0;