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

Comparing ray/src/px/pflip.c (file contents):
Revision 2.3 by greg, Wed Oct 28 11:23:22 1992 UTC vs.
Revision 2.6 by schorsch, Thu Jun 5 19:29:34 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * flip picture file horizontally and/or vertically
6   */
7  
8   #include <stdio.h>
9 + #include  <time.h>
10  
11 < #ifdef MSDOS
14 < #include  <fcntl.h>
15 < #endif
16 <
11 > #include "platform.h"
12   #include "color.h"
18
13   #include "resolu.h"
14  
15   int     order;                          /* input orientation */
# Line 31 | Line 25 | FILE   *fin;                           /* input file */
25  
26   char    *progname;
27  
34 extern char     *malloc();
28  
36
29   int
30   neworder()                      /* figure out new order from old */
31   {
# Line 56 | Line 48 | main(argc, argv)
48   int     argc;
49   char    *argv[];
50   {
51 <        int     i;
52 < #ifdef MSDOS
53 <        extern int  _fmode;
54 <        _fmode = O_BINARY;
63 <        setmode(fileno(stdout), O_BINARY);
64 < #endif
51 >        static char     picfmt[LPICFMT+1] = PICFMT;
52 >        int     i, rval;
53 >        SET_DEFAULT_BINARY();
54 >        SET_FILE_BINARY(stdout);
55          progname = argv[0];
56  
57          for (i = 1; i < argc; i++)
# Line 87 | Line 77 | char   *argv[];
77                  exit(1);
78          }
79                                          /* transfer header */
80 <        if (checkheader(fin, COLRFMT, stdout) < 0) {
80 >        if ((rval = checkheader(fin, picfmt, stdout)) < 0) {
81                  fprintf(stderr, "%s: input not a Radiance picture\n",
82                                  progname);
83                  exit(1);
84          }
85 +        if (rval)
86 +                fputformat(picfmt, stdout);
87                                          /* add new header info. */
88          printargs(i, argv, stdout);
97        fputformat(COLRFMT, stdout);
89          putchar('\n');
90                                          /* get picture size */
91          if ((order = fgetresolu(&xres, &yres, fin)) < 0) {
# Line 136 | Line 127 | scanfile()                             /* scan to the end of file */
127                  }
128          }
129          scanpos[0] = ftell(fin);
130 <        free((char *)scanin);
130 >        free((void *)scanin);
131   }
132  
133  
# Line 170 | Line 161 | flip()                                 /* flip the picture */
161                          exit(1);
162                  }
163          }
164 <        free((char *)scanin);
164 >        free((void *)scanin);
165          if (fhoriz)
166 <                free((char *)scanout);
166 >                free((void *)scanout);
167   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines