41 |
|
int argc; |
42 |
|
char **argv; |
43 |
|
{ |
44 |
< |
char *getenv(); |
45 |
< |
double atof(); |
44 |
> |
extern char *getenv(); |
45 |
> |
int nohead = 0; |
46 |
|
int i; |
47 |
|
|
48 |
|
progname = argv[0]; |
50 |
|
if ((libpath = getenv("RAYPATH")) == NULL) |
51 |
|
libpath = DEFPATH; |
52 |
|
|
53 |
< |
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
53 |
> |
for (i = 1; i < argc && argv[i][0] == '-'; i++) { |
54 |
|
switch (argv[i][1]) { |
55 |
< |
case '\0': /* scene from stdin */ |
56 |
< |
goto breakopt; |
57 |
< |
case 'w': /* supress warnings */ |
55 |
> |
case 'w': |
56 |
|
nowarn = 1; |
57 |
< |
break; |
58 |
< |
default: |
59 |
< |
sprintf(errmsg, "unknown option: '%s'", argv[i]); |
60 |
< |
error(USER, errmsg); |
63 |
< |
break; |
57 |
> |
continue; |
58 |
> |
case 'h': |
59 |
> |
nohead = 1; |
60 |
> |
continue; |
61 |
|
} |
62 |
< |
breakopt: |
62 |
> |
break; |
63 |
> |
} |
64 |
|
/* find bounding box */ |
65 |
|
bbmin[0] = bbmin[1] = bbmin[2] = FHUGE; |
66 |
|
bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE; |
67 |
|
/* read input */ |
68 |
< |
for ( ; i < argc; i++) |
69 |
< |
if (!strcmp(argv[i], "-")) /* from stdin */ |
70 |
< |
readobj(NULL, addobject); |
71 |
< |
else /* from file */ |
72 |
< |
readobj(argv[i], addobject); |
73 |
< |
/* print it out */ |
74 |
< |
printf(" xmin xmax ymin ymax zmin zmax\n"); |
68 |
> |
if (i >= argc) |
69 |
> |
readobj(NULL, addobject); |
70 |
> |
else |
71 |
> |
for ( ; i < argc; i++) |
72 |
> |
if (!strcmp(argv[i], "-")) /* from stdin */ |
73 |
> |
readobj(NULL, addobject); |
74 |
> |
else /* from file */ |
75 |
> |
readobj(argv[i], addobject); |
76 |
> |
/* print bounding box */ |
77 |
> |
if (!nohead) |
78 |
> |
printf( |
79 |
> |
" xmin xmax ymin ymax zmin zmax\n"); |
80 |
> |
|
81 |
|
printf("%9g %9g %9g %9g %9g %9g\n", bbmin[0], bbmax[0], |
82 |
|
bbmin[1], bbmax[1], bbmin[2], bbmax[2]); |
83 |
|
quit(0); |