1 |
– |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Copy data into a holodeck file |
6 |
|
*/ |
7 |
|
|
8 |
|
#include "holo.h" |
9 |
|
#include "view.h" |
13 |
– |
#include "resolu.h" |
10 |
|
|
11 |
|
#ifndef BKBSIZE |
12 |
|
#define BKBSIZE 256 /* beam clump size (kilobytes) */ |
13 |
|
#endif |
14 |
|
|
15 |
< |
int checkdepth = 1; /* check depth (!-f option)? */ |
16 |
< |
int checkrepeats = 0; /* check for repeats (-c option)? */ |
15 |
> |
int checkdepth = 1; /* check depth (!-d option)? */ |
16 |
> |
int checkrepeats = 0; /* check for repeats (-u option)? */ |
17 |
|
int frompicz; /* input from pictures & depth-buffers? */ |
18 |
|
int noutsects; /* number of output sections */ |
19 |
|
char obstr, unobstr; /* flag pointer values */ |
120 |
|
error(SYSTEM, errmsg); |
121 |
|
} |
122 |
|
/* check header and magic number */ |
123 |
< |
if (getheader(fp, holheadline, &hflags) < 0 || |
123 |
> |
if (getheader(fp, holheadline, (char *)&hflags) < 0 || |
124 |
|
hflags&H_BADF || getw(fp) != HOLOMAGIC) { |
125 |
|
sprintf(errmsg, "file \"%s\" not in holodeck format", fname); |
126 |
|
error(USER, errmsg); |
129 |
|
nextloc = ftell(fp); /* get stdio position */ |
130 |
|
fclose(fp); /* done with stdio */ |
131 |
|
for (n = 0; nextloc > 0L; n++) { /* initialize each section */ |
132 |
< |
lseek(fd, nextloc, 0); |
132 |
> |
lseek(fd, (off_t)nextloc, 0); |
133 |
|
read(fd, (char *)&nextloc, sizeof(nextloc)); |
134 |
|
hdinit(fd, NULL)->priv = hflags&H_OBST ? &obstr : |
135 |
|
hflags&H_OBSF ? &unobstr : (char *)NULL; |
232 |
|
} |
233 |
|
hdfreebeam(hp, bq[i]); /* free the beam */ |
234 |
|
} |
239 |
– |
hdflush(NULL); /* write & free clump */ |
235 |
|
return(0); |
236 |
|
} |
237 |
|
|
248 |
|
hddone(hdlist[noutsects]); /* free the section */ |
249 |
|
} |
250 |
|
close(fd); /* close input file */ |
251 |
+ |
hdflush(NULL); /* flush output */ |
252 |
|
} |
253 |
|
|
254 |
|
|
318 |
|
copystruct(&phd.vw, &stdview); |
319 |
|
phd.expos = 1.0; |
320 |
|
phd.badfmt = phd.gotview = phd.altprims = 0; |
321 |
< |
if (getheader(pfp, picheadline, &phd) < 0 || |
321 |
> |
if (getheader(pfp, picheadline, (char *)&phd) < 0 || |
322 |
|
phd.badfmt || !fgetsresolu(&prs, pfp)) { |
323 |
|
sprintf(errmsg, "bad format for picture file \"%s\"", pcf); |
324 |
|
error(USER, errmsg); |
386 |
|
/* write output and free beams */ |
387 |
|
hdflush(NULL); |
388 |
|
/* clean up */ |
389 |
< |
free((char *)cscn); |
390 |
< |
free((char *)zscn); |
389 |
> |
free((void *)cscn); |
390 |
> |
free((void *)zscn); |
391 |
|
fclose(pfp); |
392 |
|
close(zfd); |
393 |
|
} |
394 |
|
|
395 |
|
|
396 |
+ |
void |
397 |
|
eputs(s) /* put error message to stderr */ |
398 |
|
register char *s; |
399 |
|
{ |
413 |
|
} |
414 |
|
|
415 |
|
|
416 |
+ |
void |
417 |
|
quit(code) /* exit the program gracefully */ |
418 |
|
int code; |
419 |
|
{ |