--- ray/src/hd/rhcopy.c 1999/01/09 09:16:31 3.12 +++ ray/src/hd/rhcopy.c 2003/05/29 16:26:22 3.16 @@ -1,23 +1,19 @@ -/* Copyright (c) 1999 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: rhcopy.c,v 3.16 2003/05/29 16:26:22 greg Exp $"; #endif - /* * Copy data into a holodeck file */ #include "holo.h" #include "view.h" -#include "resolu.h" #ifndef BKBSIZE #define BKBSIZE 256 /* beam clump size (kilobytes) */ #endif -int checkdepth = 1; /* check depth (!-f option)? */ -int checkrepeats = 0; /* check for repeats (-c option)? */ +int checkdepth = 1; /* check depth (!-d option)? */ +int checkrepeats = 0; /* check for repeats (-u option)? */ int frompicz; /* input from pictures & depth-buffers? */ int noutsects; /* number of output sections */ char obstr, unobstr; /* flag pointer values */ @@ -111,7 +107,6 @@ openholo(fname, append) /* open existing holodeck fil char *fname; int append; { - extern long ftell(); FILE *fp; int fd; int hflags = 0; @@ -124,7 +119,7 @@ int append; error(SYSTEM, errmsg); } /* check header and magic number */ - if (getheader(fp, holheadline, &hflags) < 0 || + if (getheader(fp, holheadline, (char *)&hflags) < 0 || hflags&H_BADF || getw(fp) != HOLOMAGIC) { sprintf(errmsg, "file \"%s\" not in holodeck format", fname); error(USER, errmsg); @@ -133,7 +128,7 @@ int append; nextloc = ftell(fp); /* get stdio position */ fclose(fp); /* done with stdio */ for (n = 0; nextloc > 0L; n++) { /* initialize each section */ - lseek(fd, nextloc, 0); + lseek(fd, (off_t)nextloc, 0); read(fd, (char *)&nextloc, sizeof(nextloc)); hdinit(fd, NULL)->priv = hflags&H_OBST ? &obstr : hflags&H_OBSF ? &unobstr : (char *)NULL; @@ -199,7 +194,7 @@ static int bpcmp(b1p, b2p) /* compare beam positions on disk */ int *b1p, *b2p; { - register long pdif = beamdir[*b1p].fo - beamdir[*b2p].fo; + register off_t pdif = beamdir[*b1p].fo - beamdir[*b2p].fo; if (pdif > 0L) return(1); if (pdif < 0L) return(-1); @@ -236,7 +231,6 @@ int *bq, nb; } hdfreebeam(hp, bq[i]); /* free the beam */ } - hdflush(NULL); /* write & free clump */ return(0); } @@ -253,6 +247,7 @@ char *hdf; hddone(hdlist[noutsects]); /* free the section */ } close(fd); /* close input file */ + hdflush(NULL); /* flush output */ } @@ -322,7 +317,7 @@ char *pcf, *zbf; copystruct(&phd.vw, &stdview); phd.expos = 1.0; phd.badfmt = phd.gotview = phd.altprims = 0; - if (getheader(pfp, picheadline, &phd) < 0 || + if (getheader(pfp, picheadline, (char *)&phd) < 0 || phd.badfmt || !fgetsresolu(&prs, pfp)) { sprintf(errmsg, "bad format for picture file \"%s\"", pcf); error(USER, errmsg); @@ -390,13 +385,14 @@ char *pcf, *zbf; /* write output and free beams */ hdflush(NULL); /* clean up */ - free((char *)cscn); - free((char *)zscn); + free((void *)cscn); + free((void *)zscn); fclose(pfp); close(zfd); } +void eputs(s) /* put error message to stderr */ register char *s; { @@ -416,6 +412,7 @@ register char *s; } +void quit(code) /* exit the program gracefully */ int code; {