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

Comparing ray/src/cal/lam.c (file contents):
Revision 1.15 by greg, Thu Mar 24 18:48:28 2016 UTC vs.
Revision 1.18 by greg, Thu Jul 4 16:51:03 2019 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
14  
15   #include "platform.h"
16   #include "rtprocess.h"
17 + #include "rtio.h"
18  
19   #define MAXFILE         512             /* maximum number of files */
20  
21   #define MAXLINE         65536           /* maximum input line */
22  
22 long    incnt = 0;                      /* limit number of records? */
23
23   FILE    *input[MAXFILE];
24   int     bytsiz[MAXFILE];
25   char    *tabc[MAXFILE];
# Line 33 | Line 32 | main(argc, argv)
32   int     argc;
33   char    *argv[];
34   {
35 +        long    incnt = 0;
36          int     unbuff = 0;
37          int     binout = 0;
38 <        int     i;
39 <        char    *curtab;
40 <        int     curbytes;
38 >        char    *curtab = "\t";
39 >        int     curbytes = 0;
40          int     puteol;
41 +        int     i;
42  
43        curtab = "\t";
44        curbytes = 0;
43          nfiles = 0;
44          for (i = 1; i < argc; i++) {
45                  if (argv[i][0] == '-') {
# Line 87 | Line 85 | char   *argv[];
85                                  }
86                                  if (curbytes) {
87                                          curtab = "";
88 <                                        ++binout;
88 >                                        binout += (curbytes > 0);
89                                  }
90                                  break;
91                          case '\0':
# Line 149 | Line 147 | char   *argv[];
147                          puteol++;
148                          break;
149                  }
150 <        while (--incnt) {                       /* main loop */
150 >        do {                                    /* main loop */
151                  for (i = 0; i < nfiles; i++) {
152 <                        if (bytsiz[i]) {                /* binary file */
153 <                                if (fread(buf, bytsiz[i], 1, input[i]) < 1)
152 >                        if (bytsiz[i]) {                /* binary/fixed width */
153 >                                if (getbinary(buf, bytsiz[i], 1, input[i]) < 1)
154                                          break;
155                                  if (i)
156                                          fputs(tabc[i], stdout);
157 <                                fwrite(buf, bytsiz[i], 1, stdout);
157 >                                putbinary(buf, bytsiz[i], 1, stdout);
158                          } else {
159                                  if (fgets(buf, MAXLINE, input[i]) == NULL)
160                                          break;
# Line 172 | Line 170 | char   *argv[];
170                          putchar('\n');
171                  if (unbuff)
172                          fflush(stdout);
173 <        }
173 >        } while (--incnt);
174          return(0);
175   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines