ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/ra_im.c
Revision: 2.2
Committed: Sat Feb 22 02:07:27 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.1: +1 -4 lines
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 greg 2.2 static const char RCSid[] = "$Id$";
3 greg 1.1 #endif
4     /*
5     * ra_im.c - convert Radiance picture to imagetools raw format.
6     *
7     * 9/16/88
8     */
9    
10     #include <stdio.h>
11    
12    
13     #define PCOMM "pvalue -h -b -db"
14    
15     #define MINVAL 1
16     #define MAXVAL 252
17    
18     extern FILE *popen(), *freopen();
19    
20    
21     main(argc, argv)
22     int argc;
23     char *argv[];
24     {
25     register int c;
26     register FILE *fp;
27    
28     if (argc > 3) {
29     fputs("Usage: ", stderr);
30     fputs(argv[0], stderr);
31     fputs(" [infile [outfile]]\n", stderr);
32     exit(1);
33     }
34     if (argc > 1 && freopen(argv[1], "r", stdin) == NULL) {
35     perror(argv[1]);
36     exit(1);
37     }
38     if (argc > 2 && freopen(argv[2], "w", stdout) == NULL) {
39     perror(argv[2]);
40     exit(1);
41     }
42     if ((fp = popen(PCOMM, "r")) == NULL) {
43     perror(argv[0]);
44     exit(1);
45     }
46     while ((c = getc(fp)) != EOF) {
47     if (c < MINVAL)
48     putc(MINVAL, stdout);
49     else if (c > MAXVAL)
50     putc(MAXVAL, stdout);
51     else
52     putc(c, stdout);
53     }
54     exit(pclose(fp));
55     }