| 5 |  | * Generate renderable grids from a holodeck file | 
| 6 |  | */ | 
| 7 |  |  | 
| 8 | + | #include "platform.h" | 
| 9 | + | #include "resolu.h" | 
| 10 |  | #include "holo.h" | 
| 11 |  |  | 
| 10 | – | char    *progname;              /* global argv[0] */ | 
| 11 | – |  | 
| 12 |  | char    *mat, *name;            /* material and object id */ | 
| 13 |  | double  rad;                    /* grid line radius */ | 
| 14 |  |  | 
| 15 | + | static void gridsect(char *fname, int sect); | 
| 16 | + | static void putgrid(HOLO *hp); | 
| 17 | + | static void putline(FVECT wp[2]); | 
| 18 |  |  | 
| 19 | < | main(argc, argv) | 
| 20 | < | int     argc; | 
| 21 | < | char    *argv[]; | 
| 19 | > |  | 
| 20 | > | int | 
| 21 | > | main( | 
| 22 | > | int     argc, | 
| 23 | > | char    *argv[] | 
| 24 | > | ) | 
| 25 |  | { | 
| 26 |  | int     sect; | 
| 27 |  |  | 
| 28 | < | progname = argv[0]; | 
| 29 | < | if (argc < 5 | argc > 6) | 
| 28 | > | fixargv0(argv[0]); | 
| 29 | > | if ((argc < 5) | (argc > 6)) | 
| 30 |  | goto userr; | 
| 31 |  | mat = argv[1]; | 
| 32 |  | name = argv[2]; | 
| 43 |  | } | 
| 44 |  |  | 
| 45 |  |  | 
| 46 | < | gridsect(fname, sect)           /* get specified section(s) and print grids */ | 
| 47 | < | char    *fname; | 
| 48 | < | int     sect; | 
| 46 | > | void | 
| 47 | > | gridsect(               /* get specified section(s) and print grids */ | 
| 48 | > | char    *fname, | 
| 49 | > | int     sect | 
| 50 | > | ) | 
| 51 |  | { | 
| 52 |  | FILE    *fp; | 
| 53 |  | HOLO    hdsect; | 
| 54 |  | int     fd; | 
| 55 | < | int4    nextloc; | 
| 55 | > | int32   nextloc; | 
| 56 |  | int     n; | 
| 57 |  | /* open holodeck file */ | 
| 58 | < | if ((fp = fopen(fname, "r")) == NULL) { | 
| 58 | > | if ((fp = fopen(fname, "rb")) == NULL) { | 
| 59 |  | sprintf(errmsg, "cannot open \"%s\"", fname); | 
| 60 |  | error(SYSTEM, errmsg); | 
| 61 |  | } | 
| 68 |  | nextloc = ftell(fp);                    /* get stdio position */ | 
| 69 |  | fclose(fp);                             /* done with stdio */ | 
| 70 |  | for (n = 0; nextloc > 0L; n++) {        /* get the section(s) */ | 
| 71 | < | lseek(fd, (off_t)nextloc, 0); | 
| 71 | > | lseek(fd, (off_t)nextloc, SEEK_SET); | 
| 72 |  | read(fd, (char *)&nextloc, sizeof(nextloc)); | 
| 73 | < | if (sect < 0 | n == sect) { | 
| 73 | > | if ((sect < 0) | (n == sect)) { | 
| 74 |  | read(fd, (char *)&hdsect, sizeof(HDGRID)); | 
| 75 |  | hdcompgrid(&hdsect); | 
| 76 |  | putgrid(&hdsect);       /* print grid */ | 
| 79 |  | } | 
| 80 |  |  | 
| 81 |  |  | 
| 82 | < | putgrid(hp)                     /* run through holodeck section grid lines */ | 
| 83 | < | register HOLO   *hp; | 
| 82 | > | void | 
| 83 | > | putgrid(                        /* run through holodeck section grid lines */ | 
| 84 | > | HOLO    *hp | 
| 85 | > | ) | 
| 86 |  | { | 
| 87 | < | register int    w, i; | 
| 87 | > | int     w, i; | 
| 88 |  | int     g0, g1; | 
| 89 |  | FVECT   wp[2], mov; | 
| 90 |  | double  d; | 
| 129 |  | } | 
| 130 |  |  | 
| 131 |  |  | 
| 132 | < | putline(wp)             /* put out a line */ | 
| 133 | < | register FVECT  wp[2]; | 
| 132 | > | void | 
| 133 | > | putline(                /* put out a line */ | 
| 134 | > | FVECT   wp[2] | 
| 135 | > | ) | 
| 136 |  | { | 
| 137 |  | static int      cnt = 0; | 
| 138 |  |  |