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) */ |
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; |
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 |
|
{ |