--- ray/src/common/readwfobj.c 2020/05/02 00:12:45 2.4 +++ ray/src/common/readwfobj.c 2021/02/10 17:57:28 2.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: readwfobj.c,v 2.4 2020/05/02 00:12:45 greg Exp $"; +static const char RCSid[] = "$Id: readwfobj.c,v 2.8 2021/02/10 17:57:28 greg Exp $"; #endif /* * readobj.c @@ -171,7 +171,7 @@ loadOBJ(Scene *sc, const char *fspec) FILE *fp; char *argv[MAXARG]; int argc; - char buf[256]; + char buf[1024]; int nstats=0, nunknown=0; int onfaces; VNDX ondx; @@ -276,13 +276,23 @@ loadOBJ(Scene *sc, const char *fspec) fprintf(stderr, " %8d statements\r", nstats); } #if POPEN_SUPPORT - if (fspec[0] == '!') - pclose(fp); - else + if (fspec[0] == '!') { + if (pclose(fp) != 0) { + sprintf(errmsg, "Bad return status from: %s", fspec+1); + error(USER, errmsg); + freeScene(sc); + return(NULL); + } + } else #endif if (fp != stdin) fclose(fp); - sprintf(buf, "%d statements read from \"%s\"", nstats, fspec); + if (verbose) + fprintf(stderr, "Read %d statements\n", nstats); + if (strlen(fspec) < sizeof(buf)-32) + sprintf(buf, "%d statements read from \"%s\"", nstats, fspec); + else + sprintf(buf, "%d statements read from (TOO LONG TO SHOW)", nstats); addComment(sc, buf); if (nunknown) { sprintf(buf, "\t%d unrecognized", nunknown);