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

Comparing ray/src/px/pcomb.c (file contents):
Revision 2.5 by greg, Fri Aug 28 21:41:49 1992 UTC vs.
Revision 2.7 by greg, Mon Sep 21 12:13:48 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include <stdio.h>
14  
15 + #ifdef MSDOS
16 + #include <fcntl.h>
17 + #endif
18 +
19   #include <errno.h>
20  
21   #include "color.h"
# Line 34 | Line 38 | struct {
38  
39   int     nfiles;                         /* number of input files */
40  
41 + char    Command[] = "<Command>";
42   char    vcolin[3][4] = {"ri", "gi", "bi"};
43   char    vcolout[3][4] = {"ro", "go", "bo"};
44   char    vbrtin[] = "li";
# Line 63 | Line 68 | int    wrongformat = 0;
68  
69   FILE    *popen();
70  
71 + extern char     *emalloc();
72  
73 +
74   main(argc, argv)
75   int     argc;
76   char    *argv[];
# Line 71 | Line 78 | char   *argv[];
78          int     original;
79          double  f;
80          int     a, i;
81 + #ifdef MSDOS
82 +        extern int  _fmode;
83 +        _fmode = O_BINARY;
84 +        setmode(fileno(stdin), O_BINARY);
85 +        setmode(fileno(stdout), O_BINARY);
86 + #endif
87                                                  /* scan options */
88          for (a = 1; a < argc; a++) {
89                  if (argv[a][0] == '-')
# Line 125 | Line 138 | char   *argv[];
138                          }
139                  else {
140                          if (argv[a][0] == '!') {
141 <                                input[nfiles].name = "<Command>";
141 >                                input[nfiles].name = Command;
142                                  input[nfiles].fp = popen(argv[a]+1, "r");
143                          } else {
144                                  input[nfiles].name = argv[a];
# Line 453 | Line 466 | char   *msg;
466   }
467  
468  
456 #ifdef  NIX
457
458 quit(code)
459 int  code;
460 {
461        exit(code);
462 }
463
464 #else
465
469   quit(code)              /* exit gracefully */
470   int  code;
471   {
469        int  status;
472          register int  i;
473                                  /* close input files */
474          for (i = 0; i < nfiles; i++)
475 <                fclose(input[i].fp);
476 <                                /* reap children */
477 <        while (wait(&status) != -1)
478 <                if (code == 0)
477 <                        code = status>>8 & 0xff;
475 >                if (input[i].name == Command)
476 >                        pclose(input[i].fp);
477 >                else
478 >                        fclose(input[i].fp);
479          exit(code);
480   }
480
481 #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines