ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/ra_im.c
Revision: 2.1
Committed: Tue Nov 12 16:05:18 1991 UTC (32 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.1: +0 -0 lines
Log Message:
updated revision number for release 2.0

File Contents

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