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.8 by schorsch, Sun Mar 28 20:33:14 2004 UTC vs.
Revision 2.12 by greg, Fri Jul 19 17:37:56 2019 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * flip picture file horizontally and/or vertically
6   */
7  
8 < #include <stdio.h>
9 < #include  <time.h>
10 < #include  <string.h>
11 <
8 > #include "rtio.h"
9   #include "platform.h"
10   #include "color.h"
11   #include "resolu.h"
# Line 55 | Line 52 | main(
52          char    *argv[]
53   )
54   {
55 <        static char     picfmt[LPICFMT+1] = PICFMT;
55 >        static char     picfmt[MAXFMTLEN] = PICFMT;
56          int     i, rval;
57          SET_DEFAULT_BINARY();
58          SET_FILE_BINARY(stdout);
# Line 70 | Line 67 | main(
67                          correctorder++;
68                  else
69                          break;
70 +        if (i < argc-2)
71 +                goto userr;
72 +        if (!fhoriz && !fvert)
73 +                fprintf(stderr, "%s: warning - no operation\n", argv[0]);
74          if (i >= argc || argv[i][0] == '-') {
75 <                fprintf(stderr, "Usage: %s [-h][-v][-c] infile [outfile]\n",
76 <                                progname);
75 >                if (fvert)
76 >                        goto userr;
77 >                SET_FILE_BINARY(stdin);
78 >                fin = stdin;
79 >        } else if ((fin = fopen(argv[i], "r")) == NULL) {
80 >                fprintf(stderr, "%s: cannot open\n", argv[i]);
81                  exit(1);
82          }
78        if ((fin = fopen(argv[i], "r")) == NULL) {
79                fprintf(stderr, "%s: cannot open\n", argv[1]);
80                exit(1);
81        }
83          if (i < argc-1 && freopen(argv[i+1], "w", stdout) == NULL) {
84                  fprintf(stderr, "%s: cannot open\n", argv[i+1]);
85                  exit(1);
# Line 106 | Line 107 | main(
107                  scanfile();
108          flip();                         /* flip the image */
109          exit(0);
110 + userr:
111 +        fprintf(stderr, "Usage: %s [-h][-v][-c] infile [outfile]\n",
112 +                        progname);
113 +        exit(1);
114   }
115  
116  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines