ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/readobj.c
(Generate patch)

Comparing ray/src/common/readobj.c (file contents):
Revision 2.25 by greg, Tue Feb 7 20:28:16 2023 UTC vs.
Revision 2.29 by greg, Sat Jun 7 05:09:45 2025 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include  <stdio.h>
15  
16   #include  "platform.h"
17 #include  "paths.h"
17   #include  "standard.h"
18   #include  "object.h"
19   #include  "otypes.h"
# Line 64 | Line 63 | readobj(                               /* read in an object file or stream */
63                          getobject(inpspec, infp);
64                  }
65          }
66 <        if (inpspec[0] == '!')
67 <                pclose(infp);
68 <        else if (infp != stdin)
66 >        if (inpspec[0] == '!') {
67 >                if (pclose(infp) != 0) {
68 >                        sprintf(errmsg, "bad status from \"%s\"", inpspec);
69 >                        error(WARNING, errmsg);
70 >                }
71 >        } else if (infp != stdin)
72                  fclose(infp);
73   #ifdef getc_unlocked
74          else
# Line 128 | Line 130 | getobject(                             /* read the next object */
130          objp->oname = savqstr(sbuf);
131                                          /* get arguments */
132          if (objp->otype == MOD_ALIAS) {
133 <                OBJECT  alias;
133 >                OBJECT  ref;
134 >                OBJREC  *rfp;
135                  strcpy(sbuf, "EOF");
136                  fgetword(sbuf, MAXSTR, fp);
137 <                if ((alias = modifier(sbuf)) == OVOID) {
137 >                if ((ref = modifier(sbuf)) == OVOID) {
138                          sprintf(errmsg, "(%s): bad reference \"%s\"",
139                                          name, sbuf);
140                          objerror(objp, USER, errmsg);
141 <                }
142 <                if (objp->omod == OALIAS ||
143 <                                objp->omod == objptr(alias)->omod) {
144 <                        objp->omod = alias;
141 >                }                       /* skip pass-thru aliases */
142 >                while ((rfp=objptr(ref))->otype == MOD_ALIAS &&
143 >                                !rfp->oargs.nsargs & (rfp->omod != OVOID))
144 >                        ref = rfp->omod;
145 >
146 >                if ((objp->omod == OALIAS) | (objp->omod == rfp->omod)) {
147 >                        objp->omod = ref;
148                  } else {
149                          objp->oargs.sarg = (char **)malloc(sizeof(char *));
150                          if (objp->oargs.sarg == NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines