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

Comparing ray/src/util/getinfo.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:49:19 1989 UTC vs.
Revision 2.3 by greg, Thu Nov 12 10:06:11 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 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 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include  <stdio.h>
14  
15 + #ifdef MSDOS
16 + #include <fcntl.h>
17 + extern int  _fmode;
18 + #endif
19  
20 + extern int  fputs();
21 +
22 +
23   tabstr(s)                               /* put out line followed by tab */
24   register char  *s;
25   {
# Line 27 | Line 34 | register char  *s;
34  
35   main(argc, argv)
36   int  argc;
37 < char  *argv[];
37 > char  **argv;
38   {
39          int  dim = 0;
40          FILE  *fp;
# Line 36 | Line 43 | char  *argv[];
43          if (argc > 1 && !strcmp(argv[1], "-d")) {
44                  argc--; argv++;
45                  dim = 1;
46 + #ifdef MSDOS
47 +                setmode(fileno(stdin), _fmode = O_BINARY);
48 + #endif
49 +        } else if (argc == 2 && !strcmp(argv[1], "-")) {
50 + #ifdef MSDOS
51 +                setmode(fileno(stdin), O_BINARY);
52 +                setmode(fileno(stdout), O_BINARY);
53 + #endif
54 +                getheader(stdin, NULL, NULL);
55 +                copycat();
56 +                exit(0);
57          }
58          for (i = 1; i < argc; i++) {
59                  fputs(argv[i], stdout);
# Line 47 | Line 65 | char  *argv[];
65                                  getdim(fp);
66                          } else {
67                                  tabstr(":\n");
68 <                                getheader(fp, tabstr);
68 >                                getheader(fp, tabstr, NULL);
69                                  putchar('\n');
70                          }
71                          fclose(fp);
# Line 57 | Line 75 | char  *argv[];
75                  if (dim) {
76                          getdim(stdin);
77                  } else {
78 <                        copyheader(stdin, stdout);
78 >                        getheader(stdin, fputs, stdout);
79                          putchar('\n');
80                  }
81          exit(0);
# Line 70 | Line 88 | register FILE  *fp;
88          int  j;
89          register int  c;
90  
91 <        getheader(fp, NULL);    /* skip header */
91 >        getheader(fp, NULL, NULL);      /* skip header */
92  
93          switch (c = getc(fp)) {
94          case '+':               /* picture */
# Line 96 | Line 114 | register FILE  *fp;
114                  fputs("unknown file type\n", stdout);
115                  break;
116          }
117 + }
118 +
119 +
120 + copycat()                       /* copy input to output */
121 + {
122 +        register int    c;
123 +
124 +        while ((c = getchar()) != EOF)
125 +                putchar(c);
126   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines