--- ray/src/ot/getbbox.c 1991/05/29 17:33:17 1.1 +++ ray/src/ot/getbbox.c 2003/02/22 02:07:26 2.5 @@ -1,9 +1,6 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: getbbox.c,v 2.5 2003/02/22 02:07:26 greg Exp $"; #endif - /* * getbbox.c - compute bounding box for scene files * @@ -16,17 +13,11 @@ static char SCCSid[] = "$SunId$ LBL"; #include "object.h" -#ifndef DEFPATH -#define DEFPATH ":/usr/local/lib/ray" -#endif - char *progname; /* argv[0] */ -char *libpath; /* library search path */ - int nowarn = 0; /* supress warnings? */ -int (*addobjnotify[])() = {NULL}; /* new object notifier functions */ +void (*addobjnotify[])() = {NULL}; /* new object notifier functions */ FVECT bbmin, bbmax; /* bounding box */ @@ -41,45 +32,47 @@ main(argc, argv) /* read object files and compute bou int argc; char **argv; { - char *getenv(); - double atof(); + extern char *getenv(); + int nohead = 0; int i; progname = argv[0]; - if ((libpath = getenv("RAYPATH")) == NULL) - libpath = DEFPATH; - - for (i = 1; i < argc && argv[i][0] == '-'; i++) + for (i = 1; i < argc && argv[i][0] == '-'; i++) { switch (argv[i][1]) { - case '\0': /* scene from stdin */ - goto breakopt; - case 'w': /* supress warnings */ + case 'w': nowarn = 1; - break; - default: - sprintf(errmsg, "unknown option: '%s'", argv[i]); - error(USER, errmsg); - break; + continue; + case 'h': + nohead = 1; + continue; } -breakopt: + break; + } /* find bounding box */ bbmin[0] = bbmin[1] = bbmin[2] = FHUGE; bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE; /* read input */ - for ( ; i < argc; i++) - if (!strcmp(argv[i], "-")) /* from stdin */ - readobj(NULL, addobject); - else /* from file */ - readobj(argv[i], addobject); - /* print it out */ - printf(" xmin xmax ymin ymax zmin zmax\n"); + if (i >= argc) + readobj2(NULL, addobject); + else + for ( ; i < argc; i++) + if (!strcmp(argv[i], "-")) /* from stdin */ + readobj2(NULL, addobject); + else /* from file */ + readobj2(argv[i], addobject); + /* print bounding box */ + if (!nohead) + printf( +" xmin xmax ymin ymax zmin zmax\n"); + printf("%9g %9g %9g %9g %9g %9g\n", bbmin[0], bbmax[0], bbmin[1], bbmax[1], bbmin[2], bbmax[2]); quit(0); } +void quit(code) /* exit program */ int code; { @@ -87,12 +80,14 @@ int code; } +void cputs() /* interactive error */ { /* referenced, but not used */ } +void wputs(s) /* warning message */ char *s; { @@ -101,6 +96,7 @@ char *s; } +void eputs(s) /* put string to stderr */ register char *s; {