Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68357299
duphead.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jun 27, 01:15
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Jun 29, 01:15 (2 d)
Engine
blob
Format
Raw Data
Handle
18570058
Attached To
R10977 RADIANCE Photon Map
duphead.c
View Options
#ifndef lint
static
const
char
RCSid
[]
=
"$Id: duphead.c,v 2.7 2003/10/22 02:06:35 greg Exp $"
;
#endif
/*
* Duplicate header on stdout.
*
* Externals declared in ray.h
*/
#include "copyright.h"
#include "platform.h"
#include "standard.h"
#include "paths.h"
int
headismine
=
1
;
/* true if header file belongs to me */
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
)
return
;
if
(
headfp
!=
NULL
)
fclose
(
headfp
);
if
(
headismine
)
unlink
(
headfname
);
}
void
openheader
()
/* save standard output to header file */
{
static
char
template
[]
=
TEMPLATE
;
headfname
=
mktemp
(
template
);
if
(
freopen
(
headfname
,
"w"
,
stdout
)
==
NULL
)
{
sprintf
(
errmsg
,
"cannot open header file
\"
%s
\"
"
,
headfname
);
error
(
SYSTEM
,
errmsg
);
}
}
void
dupheader
()
/* repeat header on standard output */
{
register
int
c
;
if
(
headfp
==
NULL
)
{
if
((
headfp
=
fopen
(
headfname
,
"r"
))
==
NULL
)
error
(
SYSTEM
,
"error reopening header file"
);
SET_FILE_BINARY
(
headfp
);
}
else
if
(
fseek
(
headfp
,
0L
,
0
)
<
0
)
error
(
SYSTEM
,
"seek error on header file"
);
while
((
c
=
getc
(
headfp
))
!=
EOF
)
putchar
(
c
);
}
Event Timeline
Log In to Comment