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.12 by greg, Mon Sep 8 18:21:39 2014 UTC vs.
Revision 2.15 by greg, Tue Mar 20 17:48:16 2018 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   #include  <string.h>
12  
13   #include  "platform.h"
14 + #include  "rtprocess.h"
15   #include  "resolu.h"
16  
17   #ifdef getc_unlocked            /* avoid nasty file-locking overhead */
# Line 20 | Line 21 | static const char      RCSid[] = "$Id$";
21   #define putchar         putchar_unlocked
22   #endif
23  
23 #ifdef _WIN32
24 #include <process.h>
25 #define execvp  _execvp
26 #endif
27
24   static gethfunc tabstr;
25   static void getdim(FILE *fp);
26   static void copycat(void);
# Line 71 | Line 67 | main(
67                  execvp(argv[2], argv+2);
68                  perror(argv[2]);
69                  return 1;
70 +        } else if (argc > 2 && !strcmp(argv[1], "-a")) {
71 +                SET_FILE_BINARY(stdin);
72 +                SET_FILE_BINARY(stdout);
73 +                getheader(stdin, (gethfunc *)fputs, stdout);
74 +                for (i = 2; i < argc; i++) {
75 +                        int     len = strlen(argv[i]);
76 +                        if (!len) continue;
77 +                        fputs(argv[i], stdout);
78 +                        if (argv[i][len-1] != '\n')
79 +                                fputc('\n', stdout);
80 +                }
81 +                fputc('\n', stdout);
82 +                copycat();
83 +                return 0;
84          } else if (argc == 2 && !strcmp(argv[1], "-")) {
85                  SET_FILE_BINARY(stdin);
86                  SET_FILE_BINARY(stdout);
# Line 151 | Line 161 | copycat(void)                  /* copy input to output */
161  
162          fflush(stdout);
163          while ((n = fread(buf, 1, sizeof(buf), stdin)) > 0)
164 <                if (write(fileno(stdout), buf, n) != n)
164 >                if (writebuf(fileno(stdout), buf, n) != n)
165                          break;
166   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines