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

Comparing ray/src/px/ra_ppm.c (file contents):
Revision 2.2 by greg, Thu Dec 19 14:52:11 1991 UTC vs.
Revision 2.3 by greg, Mon Sep 21 12:14:55 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 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include  <stdio.h>
12  
13 + #ifdef MSDOS
14 + #include  <fcntl.h>
15 + #endif
16 +
17   #include  <ctype.h>
18  
19   #include  "color.h"
# Line 18 | Line 22 | static char SCCSid[] = "$SunId$ LBL";
22  
23   extern double  pow();
24  
25 + extern char  *malloc();
26 +
27   int  agryscan(), bgryscan(), aclrscan(), bclrscan();
28  
29   int  bradj = 0;                         /* brightness adjustment */
# Line 33 | Line 39 | main(argc, argv)
39   int  argc;
40   char  *argv[];
41   {
42 +        char  inpbuf[2];
43          double  gamma = 2.2;
44          int  binflag = 1;
45          int  reverse = 0;
# Line 79 | Line 86 | char  *argv[];
86          setcolrgam(gamma);
87          if (reverse) {
88                                          /* get header */
89 <                if (getc(stdin) != 'P')
89 >                if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P')
90                          quiterr("input not a Poskanzer Pixmap");
91 <                ptype = getc(stdin);
91 >                ptype = inpbuf[1];
92 > #ifdef MSDOS
93 >                if (ptype > 4)
94 >                        setmode(fileno(stdin), O_BINARY);
95 >                setmode(fileno(stdout), O_BINARY);
96 > #endif
97                  xmax = scanint(stdin);
98                  ymax = scanint(stdin);
99                  maxval = scanint(stdin);
# Line 108 | Line 120 | char  *argv[];
120                          quiterr("unsupported Pixmap type");
121                  }
122          } else {
123 + #ifdef MSDOS
124 +                setmode(fileno(stdin), O_BINARY);
125 +                if (binflag)
126 +                        setmode(fileno(stdout), O_BINARY);
127 + #endif
128                                          /* get header info. */
129                  if (checkheader(stdin, COLRFMT, NULL) < 0 ||
130                                  fgetresolu(&xmax, &ymax, stdin) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines