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 1.2 by greg, Mon Nov 11 14:01:32 1991 UTC vs.
Revision 2.4 by greg, Fri Oct 2 16:25:15 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  <math.h>
18 +
19   #include  <ctype.h>
20  
21   #include  "color.h"
22  
23   #include  "resolu.h"
24  
19 extern double  atof(), pow();
25  
26 + extern char  *malloc();
27 +
28   int  agryscan(), bgryscan(), aclrscan(), bclrscan();
29  
30   int  bradj = 0;                         /* brightness adjustment */
# Line 33 | Line 40 | main(argc, argv)
40   int  argc;
41   char  *argv[];
42   {
43 +        char  inpbuf[2];
44          double  gamma = 2.2;
45          int  binflag = 1;
46          int  reverse = 0;
# Line 79 | Line 87 | char  *argv[];
87          setcolrgam(gamma);
88          if (reverse) {
89                                          /* get header */
90 <                if (getc(stdin) != 'P')
90 >                if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P')
91                          quiterr("input not a Poskanzer Pixmap");
92 <                ptype = getc(stdin);
92 >                ptype = inpbuf[1];
93 > #ifdef MSDOS
94 >                if (ptype > 4)
95 >                        setmode(fileno(stdin), O_BINARY);
96 >                setmode(fileno(stdout), O_BINARY);
97 > #endif
98                  xmax = scanint(stdin);
99                  ymax = scanint(stdin);
100                  maxval = scanint(stdin);
# Line 108 | Line 121 | char  *argv[];
121                          quiterr("unsupported Pixmap type");
122                  }
123          } else {
124 + #ifdef MSDOS
125 +                setmode(fileno(stdin), O_BINARY);
126 +                if (binflag)
127 +                        setmode(fileno(stdout), O_BINARY);
128 + #endif
129                                          /* get header info. */
130                  if (checkheader(stdin, COLRFMT, NULL) < 0 ||
131                                  fgetresolu(&xmax, &ymax, stdin) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines