--- ray/src/rt/rv2.c 1993/08/25 14:13:51 2.18 +++ ray/src/rt/rv2.c 1993/12/15 16:59:14 2.22 @@ -32,8 +32,10 @@ static char SCCSid[] = "$SunId$ LBL"; extern char *atos(); -extern char rifname[]; /* rad input file name */ +extern FILE *popen(); +extern char rifname[128]; /* rad input file name */ + extern char VersionID[]; extern char *progname; extern char *octname; @@ -163,7 +165,7 @@ char *s; if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ copystruct(&nv, &stdview); - if ((fname = getpath(buf, NULL, 0)) == NULL || + if ((fname = getpath(buf, "", R_OK)) == NULL || (success = viewfile(fname, &nv, NULL)) == -1) { sprintf(errmsg, "cannot open \"%s\"", buf); error(COMMAND, errmsg); @@ -193,9 +195,18 @@ char *s; char *fname; FILE *fp; - if (*atos(view, sizeof(view), s)) + if (*atos(view, sizeof(view), s)) { + if (isint(view)) { + error(COMMAND, "cannot write view by number"); + return; + } s = sskip(s); - if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') { + } + while (isspace(*s)) + s++; + if (*s) + atos(rifname, sizeof(rifname), s); + else if (rifname[0] == '\0') { error(COMMAND, "no previous rad file"); return; } @@ -226,12 +237,13 @@ char *s; s = sskip(s); else strcat(buf, "1"); - if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') { + if (*s) + atos(rifname, sizeof(rifname), s); + else if (rifname[0] == '\0') { error(COMMAND, "no previous rad file"); return; } - fname = getpath(rifname, NULL, 0); - if (fname == NULL || access(fname, R_OK) == -1) { + if ((fname = getpath(rifname, "", R_OK)) == NULL) { sprintf(errmsg, "cannot access \"%s\"", rifname); error(COMMAND, errmsg); return; @@ -625,7 +637,8 @@ char *s; (*dev->comout)("ray hit nothing"); else { sprintf(buf, "ray hit %s %s \"%s\"", - objptr(thisray.ro->omod)->oname, + thisray.ro->omod == OVOID ? VOIDID : + objptr(thisray.ro->omod)->oname, ofun[thisray.ro->otype].funame, thisray.ro->oname); (*dev->comout)(buf); @@ -658,7 +671,11 @@ char *s; COLR *scanline; int y; - if (sscanf(s, "%s", buf) != 1 && buf[0] == '\0') { + while (isspace(*s)) + s++; + if (*s) + atos(buf, sizeof(buf), s); + else if (buf[0] == '\0') { error(COMMAND, "no file"); return; }