--- ray/src/rt/duphead.c 1993/09/21 10:58:22 2.2 +++ ray/src/rt/duphead.c 2003/06/05 19:29:34 2.5 @@ -1,13 +1,14 @@ -/* Copyright (c) 1993 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: duphead.c,v 2.5 2003/06/05 19:29:34 schorsch Exp $"; #endif - /* * Duplicate header on stdout. + * + * Externals declared in ray.h */ +#include "copyright.h" + #include "standard.h" #include "paths.h" @@ -18,17 +19,19 @@ static char *headfname = NULL; /* temp file name */ static FILE *headfp = NULL; /* temp file pointer */ +void headclean() /* remove header temp file (if one) */ { - if (headfname != NULL) { - if (headfp != NULL) - fclose(headfp); - if (headismine) - unlink(headfname); - } + if (headfname == NULL) + return; + if (headfp != NULL) + fclose(headfp); + if (headismine) + unlink(headfname); } +void openheader() /* save standard output to header file */ { static char template[] = TEMPLATE; @@ -41,6 +44,7 @@ openheader() /* save standard output to header file } +void dupheader() /* repeat header on standard output */ { register int c; @@ -48,9 +52,7 @@ dupheader() /* repeat header on standard output */ if (headfp == NULL) { if ((headfp = fopen(headfname, "r")) == NULL) error(SYSTEM, "error reopening header file"); -#ifdef MSDOS - setmode(fileno(headfp), O_BINARY); -#endif + SET_FILE_BINARY(headfp); } else if (fseek(headfp, 0L, 0) < 0) error(SYSTEM, "seek error on header file"); while ((c = getc(headfp)) != EOF)