Mapper
libraries
shef
shef_test.c
Go to the documentation of this file.
1
#define _POSIX_SOURCE
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <ctype.h>
5
#include <dirent.h>
6
#include <unistd.h>
7
#include <math.h>
8
#include <string.h>
9
#include <fcntl.h>
10
#include <sys/stat.h>
11
#include "
shef_structs_external.h
"
12
13
14
/*---------------------------------------------------------------------
15
16
FUNCTION shef_test
17
18
PURPOSE
19
To test the shef_decoder. The user will provide the filename
20
of the file containing shef data. Two files will be created,
21
one containing the shef data and any errors. The second file
22
contains full shef-out records of all data.
23
24
VERSION and UPDATES
25
1.0 SEP 95 David G. Brandon
26
Original Version
27
1.1 OCT 95 DGB
28
Add PE_SIZE and TS_SIZE macros for dimensioning.
29
1.2 JAN 96 DGB
30
Add message that tells the user how many errors
31
were detected.
32
1.3 JAN 96 DGB
33
Update struct t_data to include lcent (century).
34
Increase message5 array to 63.
35
1.4 JAN 96 DGB
36
Print out warnings as well as errors.
37
1.5x SEP 10 97 DGB
38
Add the use of MAX_SHEF_INPUT so that the input line can
39
be longer than 80 characters.
40
41
--------------------------------------------------------------------- */
42
43
44
shef_test
()
45
{
46
int
i
;
47
48
char
buffer[
MAX_SHEF_INPUT
];
/* dgb:09/10/97 */
49
50
fprintf
(stdout,
"\n------------------------------"
);
51
fprintf
(stdout,
"\n shef_decode: test option.\n"
);
52
fprintf
(stdout,
"\n------------------------------"
);
53
fprintf
(stdout,
"\n input file: "
);
54
fgets(buffer,
sizeof
(buffer),stdin);
55
memset(&buffer[strlen(buffer) -1],0,1);
56
57
/* store file names */
58
memset(
files_
.
shef_in
,0,
sizeof
(
files_
.
shef_in
));
59
memset(
files_
.
shef_decode_err
,0,
sizeof
(
files_
.
shef_decode_err
));
60
memset(
files_
.
shef_out
,0,
sizeof
(
files_
.
shef_out
));
61
strncpy(
files_
.
shef_in
,buffer,
sizeof
(
files_
.
shef_in
));
/* dgb:10/03/02 */
62
sprintf
(
files_
.
shef_decode_err
,
"%s.err"
,buffer);
63
sprintf
(
files_
.
shef_out
,
"%s.out"
,buffer);
64
65
/* set flags */
66
strncpy(&
cont_
.
out_flag
[0],
"+"
,1);
67
strncpy(&
cont_
.
error_flag
[0],
"+"
,1);
68
strncpy(&
cont_
.
post_flag
[0],
"-"
,1);
69
70
/* call decoder */
71
if
(
shefop
() == 0 )
72
{
73
shdrive
();
74
shefcl
();
75
}
76
77
fprintf
(stdout,
"\n *** YOU HAVE %d SHEF ERRORS ***"
,
error_
.
nerror
);
78
fprintf
(stdout,
"\n *** YOU HAVE %d SHEF WARNINGS ***\n\n"
,
error_
.
nwarn
);
79
}
i
static int i
Definition:
get_apps_defaults.c:110
sprintf
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
fprintf
fprintf(fp,"%d %d %d %d 1\n", iminx, iminy, maxi, maxj)
shdrive
void shdrive()
Definition:
shdrive.c:39
MAX_SHEF_INPUT
#define MAX_SHEF_INPUT
Definition:
shef.h:38
error_
struct t_error_ error_
files_
struct t_files_ files_
cont_
struct t_cont_ cont_
shef_structs_external.h
shef_test
shef_test()
Definition:
shef_test.c:44
shefcl
void shefcl()
Definition:
shefcl.c:35
shefop
int shefop()
Definition:
shefop.c:75
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_cont_::post_flag
char post_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_::shef_decode_err
char shef_decode_err[MAX_F]
Definition:
shef_structs.h:106
t_files_::shef_out
char shef_out[MAX_F]
Definition:
shef_structs.h:106
Generated by
1.9.1