--- ray/src/ot/readobj2.c 2003/06/26 00:58:10 2.6 +++ ray/src/ot/readobj2.c 2025/04/22 14:51:29 2.14 @@ -1,28 +1,34 @@ #ifndef lint -static const char RCSid[] = "$Id: readobj2.c,v 2.6 2003/06/26 00:58:10 schorsch Exp $"; +static const char RCSid[] = "$Id: readobj2.c,v 2.14 2025/04/22 14:51:29 greg Exp $"; #endif /* * readobj2.c - routines for reading in object descriptions. */ #include +#include -#include "standard.h" #include "platform.h" +#include "paths.h" +#include "rtmath.h" +#include "rtio.h" +#include "rterror.h" #include "object.h" #include "otypes.h" +#include "oconv.h" -extern char *fgetword(); +static void getobject2(char *name, FILE *fp, ro_cbfunc f); -readobj2(input, callback) /* read in an object file or stream */ -char *input; -int (*callback)(); + +void +readobj2( /* read in an object file or stream */ + char *input, + ro_cbfunc callback +) { - FILE *popen(); - char *fgetline(); FILE *infp; - char buf[512]; + char buf[2048]; register int c; if (input == NULL) { @@ -51,17 +57,22 @@ int (*callback)(); getobject2(input, infp, callback); } } - if (input[0] == '!') - pclose(infp); - else + if (input[0] == '!') { + if (pclose(infp) != 0) { + sprintf(errmsg, "bad status from \"%s\"", input); + error(WARNING, errmsg); + } + } else fclose(infp); } -getobject2(name, fp, f) /* read the next object */ -char *name; -FILE *fp; -int (*f)(); +static void +getobject2( /* read the next object */ + char *name, + FILE *fp, + ro_cbfunc f +) { char sbuf[MAXSTR]; OBJREC thisobj;