Mapper
libraries
shef
shefclose.c
Go to the documentation of this file.
1
/*Translated by FOR_C, v3.4.2 (-), on 06/07/94 at 17:01:19 */
2
/*FOR_C Options SET: c=2 com=u do=r4 ftn=2ln6k op=iv s=dvn str=l sq=i */
3
#define _POSIX_SOURCE
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include <ctype.h>
7
#include <dirent.h>
8
#include <unistd.h>
9
#include <math.h>
10
#include <string.h>
11
#include <fcntl.h>
12
#include <sys/stat.h>
13
#include "
shef_structs_external.h
"
14
15
/*---------------------------------------------------------------------
16
17
NAME
18
SUBROUTINE SHEFCLOSE
19
20
PURPOSE
21
Close the files
22
23
VERSION and UPDATES
24
1.0 MAY 94 David G. Brandon
25
Also Translated to 'C' using FOR_C
26
1.1 OCT 95 DGB
27
Add closing of *sensors, *sqlerrors, *fp_postlog, *testfile
28
1.2 MAR 30 2001 DGB
29
Set filepointers to NULL after closing.
30
*--------------------------------------------------------------------- */
31
32
33
void
shefclose
()
34
{
35
36
if
(
fp_
.
icher
!= NULL )
37
fflush(
fp_
.
icher
);
38
39
if
(
fp_
.
lchn
!= NULL )
40
{
41
fclose
(
fp_
.
lchn
);
42
fp_
.
lchn
= 0;
/* dgb:03/30/01 */
43
}
44
if
(
fp_
.
mchn
!= NULL )
45
{
46
fclose
(
fp_
.
mchn
);
47
fp_
.
mchn
= 0;
/* dgb:03/30/01 */
48
}
49
if
(
fp_
.
kchn
!= NULL )
50
{
51
fclose
(
fp_
.
kchn
);
52
fp_
.
kchn
= 0;
/* dgb:03/30/01 */
53
}
54
/* If there are errors, always write out error file.
55
* If the control variable is set to '+', write
56
* out error file. If the control variable is set to
57
* '-', and there are now warnings, do not write.
58
* */
59
if
(
error_
.
nerror
!= 0 ||
error_
.
nwarn
!= 0 )
60
{
61
62
if
(
fp_
.
icher
!= NULL )
63
{
64
fclose
(
fp_
.
icher
);
65
fp_
.
icher
= 0;
/* dgb:03/30/01 */
66
}
67
}
68
else
69
{
70
71
if
(
cont_
.
error_flag
[0] !=
'+'
)
72
{
73
if
(
fp_
.
icher
!= NULL )
74
{
75
fclose
(
fp_
.
icher
);
/* dgb:03/30/01 */
76
remove(
tempfiles_
.
err_file
);
77
}
78
}
79
else
80
{
81
if
(
fp_
.
icher
!= NULL )
82
{
83
fclose
(
fp_
.
icher
);
84
fp_
.
icher
= 0;
/* dgb:03/30/01 */
85
}
86
}
87
}
88
89
if
(
cont_
.
out_flag
[0] ==
'+'
)
90
{
91
if
(
fp_
.
jchn
!= NULL )
92
{
93
fflush(
fp_
.
jchn
);
94
fclose
(
fp_
.
jchn
);
95
fp_
.
jchn
= 0;
/* dgb:03/30/01 */
96
}
97
}
98
99
if
(
fp_postlog
!= NULL )
100
{
101
fflush(
fp_postlog
);
102
fclose
(
fp_postlog
);
103
fp_postlog
= 0;
/* dgb:03/30/01 */
104
}
105
106
if
(
sensors
!= NULL )
107
{
108
fflush(
sensors
);
109
fclose
(
sensors
);
110
sensors
= 0;
/* dgb:03/30/01 */
111
}
112
113
if
(
sqlerrors
!= NULL )
114
{
115
fflush(
sqlerrors
);
116
fclose
(
sqlerrors
);
117
sqlerrors
= 0;
/* dgb:03/30/01 */
118
}
119
120
if
(
testfile
!= NULL )
121
{
122
fflush(
testfile
);
123
fclose
(
testfile
);
124
testfile
= 0;
/* dgb:03/30/01 */
125
}
126
127
return
;
128
129
}
130
fclose
fclose(fp)
error_
struct t_error_ error_
fp_postlog
FILE * fp_postlog
Definition:
shef_structs.h:262
sqlerrors
FILE * sqlerrors
Definition:
shef_structs.h:262
sensors
FILE * sensors
Definition:
shef_structs.h:262
fp_
struct t_pointers_ fp_
tempfiles_
struct t_tempfiles_ tempfiles_
testfile
FILE * testfile
Definition:
shef_structs.h:262
cont_
struct t_cont_ cont_
shef_structs_external.h
shefclose
void shefclose()
Definition:
shefclose.c:33
t_cont_::error_flag
char error_flag[13]
Definition:
shef_structs.h:75
t_cont_::out_flag
char out_flag[13]
Definition:
shef_structs.h:75
t_error_::nerror
short int nerror
Definition:
shef_structs.h:103
t_error_::nwarn
short int nwarn
Definition:
shef_structs.h:103
t_pointers_::lchn
FILE * lchn
Definition:
shef_structs.h:72
t_pointers_::icher
FILE * icher
Definition:
shef_structs.h:72
t_pointers_::kchn
FILE * kchn
Definition:
shef_structs.h:72
t_pointers_::mchn
FILE * mchn
Definition:
shef_structs.h:72
t_pointers_::jchn
FILE * jchn
Definition:
shef_structs.h:72
t_tempfiles_::err_file
char err_file[MAX_F]
Definition:
shef_structs.h:222
Generated by
1.9.1