Mapper
libraries
shef
shefcl.c
Go to the documentation of this file.
1
/*Translated by FOR_C, v3.4.2 (-), on 06/07/94 at 17:01:33 */
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 SHEFCL
19
20
PURPOSE
21
Close files used by the shef decoder during each iteration.
22
23
VERSION and UPDATES
24
1.0 MAY 94 David G. Brandon
25
Original Version
26
Also Translated to 'C' using FOR_C
27
1.1 OCT 95 DGB
28
Do not delete input file if test version is requested.
29
1.2 MAR 18 01 DGB
30
Copy file to remote_dir if REMOTE_Q flag is on
31
Set fclose to 0
32
*--------------------------------------------------------------------- */
33
34
35
void
shefcl
()
36
{
37
38
char
tempb[300];
/* dgb:03/18/01 */
39
/* Close Files */
40
if
( !
test_
.
test_flag
)
/* dgb:10/01/95 */
41
{
42
if
(
fp_
.
lchn
!= NULL )
43
{
44
fclose
(
fp_
.
lchn
);
45
fp_
.
lchn
= 0;
/* dgb:03/18/01 */
46
}
47
/* copy file to the remote q if REMOTE_Q == 1 */
48
49
if
(
REMOTE_Q
== 1 )
50
{
51
sprintf
(tempb,
"cp %s %s"
,
files_
.
shef_in
,
files_
.
remote_dir
);
/* dgb:03/18/01 */
52
system
(tempb);
/* dgb:03/18/01 */
53
}
54
remove(
files_
.
shef_in
);
55
}
56
/* dotbtemp file no longer used..virtual buffer now allows for
57
48 values in .B line
58
fclose(fp_.mchn);
59
remove(tempfiles_.dotbtemp);
60
61
*/
62
if
(
cont_
.
out_flag
[0] ==
'+'
)
63
{
64
if
(
fp_
.
jchn
!= NULL )
65
{
66
fclose
(
fp_
.
jchn
);
67
fp_
.
jchn
= 0;
/* dgb:03/18/01 */
68
}
69
}
70
71
72
/* If there are errors, always write out error file.
73
If the control variable is set to '+', write
74
out error file. If the control variable is set to
75
'-', and there are no warnings, do not write. */
76
77
if
(
error_
.
nerror
!= 0 ||
error_
.
nwarn
!= 0 )
78
{
79
if
(
fp_
.
icher
!= NULL )
80
{
81
fclose
(
fp_
.
icher
);
82
fp_
.
icher
= 0;
/* dgb:03/18/01 */
83
}
84
}
85
else
86
{
87
88
if
(
cont_
.
error_flag
[0] !=
'+'
)
89
{
90
if
(
fp_
.
icher
!= NULL )
91
{
92
fclose
(
fp_
.
icher
);
93
fp_
.
icher
= 0;
/* dgb:03/18/01 */
94
remove(
tempfiles_
.
err_file
);
95
}
96
}
97
else
98
{
99
if
(
fp_
.
icher
!= NULL )
100
{
101
fclose
(
fp_
.
icher
);
102
fp_
.
icher
= 0;
/* dgb:03/18/01 */
103
}
104
}
105
106
}
107
108
109
return
;
110
111
}
112
fclose
fclose(fp)
sprintf
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
system
system(tarbuf)
error_
struct t_error_ error_
REMOTE_Q
int REMOTE_Q
Definition:
shef_structs.h:261
files_
struct t_files_ files_
fp_
struct t_pointers_ fp_
test_
struct s_test test_
tempfiles_
struct t_tempfiles_ tempfiles_
cont_
struct t_cont_ cont_
shef_structs_external.h
shefcl
void shefcl()
Definition:
shefcl.c:35
s_test::test_flag
int test_flag
Definition:
shef_structs.h:211
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_files_::shef_in
char shef_in[MAX_F]
Definition:
shef_structs.h:106
t_files_::remote_dir
char remote_dir[MAX_F]
Definition:
shef_structs.h:106
t_pointers_::lchn
FILE * lchn
Definition:
shef_structs.h:72
t_pointers_::icher
FILE * icher
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