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

Comparing ray/src/cal/rsplit.c (file contents):
Revision 1.6 by greg, Fri Jul 19 17:37:55 2019 UTC vs.
Revision 1.7 by greg, Sat Jul 20 23:12:53 2019 UTC

# Line 19 | Line 19 | static const char      RCSid[] = "$Id$";
19  
20   #define MAXFILE         512             /* maximum number of files */
21  
22 < FILE            *output[MAXFILE];
23 < int             bytsiz[MAXFILE];
24 < short           hdrflags[MAXFILE];
25 < const char      *format[MAXFILE];
26 < int             termc[MAXFILE];
27 < int             nfiles = 0;
22 > static FILE             *output[MAXFILE];
23 > static int              bytsiz[MAXFILE];
24 > static short            hdrflags[MAXFILE];
25 > static const char       *format[MAXFILE];
26 > static int              termc[MAXFILE];
27 > static int              nfiles = 0;
28  
29 < int             outheader = 0;          /* output header to each stream? */
29 > static int      outheader = 0;          /* output header to each stream? */
30  
31 < RESOLU          ourres = {PIXSTANDARD, 0, 0};
31 > static RESOLU   ourres = {PIXSTANDARD, 0, 0};
32  
33 < char            buf[16384];
33 > static char     buf[16384];             /* input buffer used in scanOK() */
34  
35  
36   /* process header line */
# Line 164 | Line 164 | main(int argc, char *argv[])
164                                          break;
165                                  case 'a':
166                                          curfmt = "ascii";
167 <                                        curbytes = argv[i][3] ? -1 : 0;
167 >                                        curbytes = -1;
168                                          break;
169                                  default:
170                                          goto badopt;
# Line 177 | Line 177 | main(int argc, char *argv[])
177                                          fputs(": output size too big\n", stderr);
178                                          return(1);
179                                  }
180 <                                if (curbytes > 0) {
181 <                                        curterm = '\0';
182 <                                        ++bininp;
183 <                                }
180 >                                bininp += (curbytes > 0);
181                                  break;
182                          case '\0':
183                                  outres |= (curflags & DORESOLU);
# Line 295 | Line 292 | main(int argc, char *argv[])
292                          if (bytsiz[i] > 0) {            /* binary output */
293                                  if (getbinary(buf, bytsiz[i], 1, stdin) < 1)
294                                          break;
295 <                                if (putbinary(buf, bytsiz[i], 1, output[i]) != 1)
295 >                                if (putbinary(buf, bytsiz[i], 1, output[i]) < 1)
296                                          break;
297                          } else if (bytsiz[i] < 0) {     /* N-field output */
298                                  int     n = -bytsiz[i];
# Line 316 | Line 313 | main(int argc, char *argv[])
313                                          break;
314                                  if (termc[i] != '\n')   /* add EOL if none */
315                                          fputc('\n', output[i]);
316 +                        }
317 +                                                        /* skip input EOL? */
318 +                        if (!bininp && termc[nfiles-1] != '\n') {
319 +                                int     c = getchar();
320 +                                if ((c != '\n') & (c != EOF))
321 +                                        ungetc(c, stdin);
322                          }
323                  }
324                  if (i < nfiles)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines