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

Comparing ray/src/util/getinfo.c (file contents):
Revision 2.16 by greg, Tue Mar 20 18:18:39 2018 UTC vs.
Revision 2.17 by greg, Sun Jun 9 18:22:44 2019 UTC

# Line 62 | Line 62 | main(
62                  SET_FILE_BINARY(stdin);
63                  SET_FILE_BINARY(stdout);
64                  setvbuf(stdin, NULL, _IONBF, 2);
65 <                getheader(stdin, (gethfunc *)fputs, stdout);
65 >                if (getheader(stdin, (gethfunc *)fputs, stdout) < 0)
66 >                        return 1;
67                  printargs(argc-2, argv+2, stdout);
68                  fputc('\n', stdout);
69                  fflush(stdout);
# Line 72 | Line 73 | main(
73          } else if (argc > 2 && !strcmp(argv[1], "-a")) {
74                  SET_FILE_BINARY(stdin);
75                  SET_FILE_BINARY(stdout);
76 <                getheader(stdin, (gethfunc *)fputs, stdout);
76 >                if (getheader(stdin, (gethfunc *)fputs, stdout) < 0)
77 >                        return 1;
78                  for (i = 2; i < argc; i++) {
79                          int     len = strlen(argv[i]);
80                          if (!len) continue;
# Line 86 | Line 88 | main(
88          } else if (argc == 2 && !strcmp(argv[1], "-")) {
89                  SET_FILE_BINARY(stdin);
90                  SET_FILE_BINARY(stdout);
91 <                getheader(stdin, NULL, NULL);
91 >                if (getheader(stdin, NULL, NULL) < 0)
92 >                        return 1;
93                  copycat();
94                  return 0;
95          }
# Line 110 | Line 113 | main(
113                  if (dim) {
114                          getdim(stdin);
115                  } else {
116 <                        getheader(stdin, (gethfunc *)fputs, stdout);
116 >                        if (getheader(stdin, (gethfunc *)fputs, stdout) < 0)
117 >                                return 1;
118                          fputc('\n', stdout);
119                  }
120          }
# Line 125 | Line 129 | getdim(                                /* get dimensions from file */
129   {
130          int  j;
131          int  c;
132 <
133 <        getheader(fp, NULL, NULL);      /* skip header */
134 <
132 >                                /* skip header */
133 >        if (getheader(fp, NULL, NULL) < 0) {
134 >                fputs("bad header\n", stdout);
135 >                return;
136 >        }
137          switch (c = getc(fp)) {
138          case '+':               /* picture */
139          case '-':

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines