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

Comparing ray/src/px/ra_rgbe.c (file contents):
Revision 2.1 by greg, Tue Nov 12 16:05:45 1991 UTC vs.
Revision 2.6 by greg, Thu Nov 18 09:55:20 1993 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 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include  <stdio.h>
12 <
12 > #include  <math.h>
13   #include  "color.h"
14   #include  "resolu.h"
15  
16 + #ifdef MSDOS
17 + #include  <fcntl.h>
18 + #endif
19 +
20 + extern char  *malloc();
21 +
22   int  bradj = 0;                         /* brightness adjustment */
23  
24   int  doflat = 1;                        /* produce flat file */
# Line 25 | Line 31 | int  argc;
31   char  *argv[];
32   {
33          int  i;
34 <        
34 > #ifdef MSDOS
35 >        extern int  _fmode;
36 >        _fmode = O_BINARY;
37 >        setmode(fileno(stdin), O_BINARY);
38 >        setmode(fileno(stdout), O_BINARY);
39 > #endif
40          progname = argv[0];
41  
42          for (i = 1; i < argc; i++)
# Line 53 | Line 64 | char  *argv[];
64                  exit(1);
65          }
66          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
67 <                fprintf(stderr, "can't open output \"%s\"\n",
67 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
68                                  progname, argv[i+1]);
69                  exit(1);
70          }
# Line 79 | Line 90 | char  *err;
90  
91   transfer()              /* transfer Radiance picture */
92   {
82        extern double   pow();
93          int     order;
94 <        int     xmax, ymax;
94 >        int     xmax, ymax;
95          COLR    *scanin;
86        register int    x;
96          int     y;
97                                  /* get header info. */
98          if (checkheader(stdin, COLRFMT, stdout) < 0 ||
99                          (order = fgetresolu(&xmax, &ymax, stdin)) < 0)
100                  quiterr("bad picture format");
101 +        fputs(progname, stdout);
102          if (bradj)
103 <                fputexpos(pow(2.0, (double)bradj), stdout);
104 <        if (!doflat) {
103 >                printf(" -e %+d", bradj);
104 >        if (doflat)
105 >                fputs("\n", stdout);
106 >        else {
107 >                fputs(" -r\n", stdout);
108                  fputformat(COLRFMT, stdout);
109 <                printf("%s -r\n\n", progname);
110 <        } else
111 <                printf("%s\n\n", progname);
109 >        }
110 >        if (bradj)
111 >                fputexpos(pow(2.0, (double)bradj), stdout);
112 >        fputs("\n", stdout);
113          fputresolu(order, xmax, ymax, stdout);
114                                                  /* allocate scanline */
115          scanin = (COLR *)malloc(xmax*sizeof(COLR));
# Line 112 | Line 126 | transfer()             /* transfer Radiance picture */
126                  else
127                          fwritecolrs(scanin, xmax, stdout);
128                  if (ferror(stdout))
129 <                        quiterr("error writing rasterfile");
129 >                        quiterr("error writing output picture");
130          }
131                                                  /* free scanline */
132          free((char *)scanin);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines