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

Comparing ray/src/rt/duphead.c (file contents):
Revision 2.1 by greg, Wed Jan 20 15:18:59 1993 UTC vs.
Revision 2.6 by schorsch, Sun Jun 8 12:03:10 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1993 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   * Duplicate header on stdout.
6 + *
7 + * Externals declared in ray.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include  "standard.h"
13 + #include  "platform.h"
14   #include  "paths.h"
15  
16  
# Line 18 | Line 20 | static char  *headfname = NULL;        /* temp file name */
20   static FILE  *headfp = NULL;    /* temp file pointer */
21  
22  
23 + void
24   headclean()                     /* remove header temp file (if one) */
25   {
26 <        if (headfname != NULL) {
27 <                if (headfp != NULL)
28 <                        fclose(headfp);
29 <                if (headismine)
30 <                        unlink(headfname);
31 <        }
26 >        if (headfname == NULL)
27 >                return;
28 >        if (headfp != NULL)
29 >                fclose(headfp);
30 >        if (headismine)
31 >                unlink(headfname);
32   }
33  
34  
35 + void
36   openheader()                    /* save standard output to header file */
37   {
38 <        headfname = mktemp(TEMPLATE);
38 >        static char  template[] = TEMPLATE;
39 >
40 >        headfname = mktemp(template);
41          if (freopen(headfname, "w", stdout) == NULL) {
42                  sprintf(errmsg, "cannot open header file \"%s\"", headfname);
43                  error(SYSTEM, errmsg);
# Line 39 | Line 45 | openheader()                   /* save standard output to header file
45   }
46  
47  
48 + void
49   dupheader()                     /* repeat header on standard output */
50   {
51          register int  c;
# Line 46 | Line 53 | dupheader()                    /* repeat header on standard output */
53          if (headfp == NULL) {
54                  if ((headfp = fopen(headfname, "r")) == NULL)
55                          error(SYSTEM, "error reopening header file");
56 < #ifdef MSDOS
50 <                setmode(fileno(headfp), O_BINARY);
51 < #endif
56 >                SET_FILE_BINARY(headfp);
57          } else if (fseek(headfp, 0L, 0) < 0)
58                  error(SYSTEM, "seek error on header file");
59          while ((c = getc(headfp)) != EOF)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines