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

Comparing ray/src/gen/mkillum.c (file contents):
Revision 2.40 by greg, Sun Aug 11 02:57:49 2013 UTC vs.
Revision 2.45 by greg, Tue Apr 22 04:45:25 2025 UTC

# Line 8 | Line 8 | static const char RCSid[] = "$Id$";
8   #include  <signal.h>
9   #include  <ctype.h>
10  
11 < #include  "rtprocess.h" /* win_popen() */
11 > #include  "paths.h"             /* win_popen() */
12   #include  "mkillum.h"
13  
14                                  /* default parameters */
# Line 45 | Line 45 | int    doneheader = 0;         /* printed header yet? */
45   int     warnings = 1;           /* print warnings? */
46  
47   void init(char *octnm, int np);
48 < void filter(register FILE       *infp, char     *name);
48 > void filter(FILE        *infp, char     *name);
49   void xoptions(char      *s, char        *nm);
50   void printopts(void);
51 < void printhead(register int  ac, register char  **av);
51 > void printhead(int  ac, char  **av);
52   void xobject(FILE  *fp, char  *nm);
53  
54  
# Line 61 | Line 61 | main(          /* compute illum distributions using rtrace */
61          int     nprocs = 1;
62          FILE    *fp;
63          int     rval;
64 <        register int    i;
64 >        int     i;
65                                  /* set global arguments */
66          gargv = argv;
67          progname = gargv[0];
# Line 148 | Line 148 | init(char *octnm, int np)              /* start rendering process(
148  
149   void
150   eputs(                          /* put string to stderr */
151 <        register char  *s
151 >        const char  *s
152   )
153   {
154          static int  midline = 0;
# Line 164 | Line 164 | eputs(                         /* put string to stderr */
164  
165  
166   void
167 < wputs(s)                        /* print warning if enabled */
168 < char  *s;
167 > wputs(const char *s)                    /* print warning if enabled */
168   {
169          if (warnings)
170                  eputs(s);
# Line 173 | Line 172 | char  *s;
172  
173  
174   void
175 < quit(ec)                        /* make sure exit is called */
177 < int     ec;
175 > quit(int ec)                    /* make sure exit is called */
176   {
177          if (ray_pnprocs > 0)    /* close children if any */
178 <                ray_pclose(0);          
178 >                ray_pclose(0);
179 >        else if (ray_pnprocs < 0)
180 >                _exit(ec);      /* avoid flush() in child */
181          exit(ec);
182   }
183  
184  
185   void
186   filter(         /* process stream */
187 <        register FILE   *infp,
187 >        FILE    *infp,
188          char    *name
189   )
190   {
191          char    buf[512];
192          FILE    *pfp;
193 <        register int    c;
193 >        int     c;
194  
195          while ((c = getc(infp)) != EOF) {
196                  if (isspace(c))
# Line 207 | Line 207 | filter(                /* process stream */
207                                  error(SYSTEM, errmsg);
208                          }
209                          filter(pfp, buf);
210 <                        pclose(pfp);
210 >                        if (pclose(pfp) != 0) {
211 >                                sprintf(errmsg, "bad status from \"%s\"", buf);
212 >                                error(USER, errmsg);
213 >                        }
214                  } else {                                /* object */
215                          ungetc(c, infp);
216                          xobject(infp, name);
# Line 222 | Line 225 | xoptions(                      /* process options in string s */
225          char    *nm
226   )
227   {
225        extern FILE     *freopen();
228          char    buf[64];
229          int     negax;
230          int     nerrs = 0;
231 <        register char   *cp;
231 >        char    *cp;
232  
233          if (strncmp(s, "#@mkillum", 9) || !isspace(s[9])) {
234                  fputs(s, stdout);               /* not for us */
# Line 409 | Line 411 | printopts(void)                        /* print out option default values *
411  
412   void
413   printhead(                      /* print out header */
414 <        register int  ac,
415 <        register char  **av
414 >        int  ac,
415 >        char  **av
416   )
417   {
418          putchar('#');

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines