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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines