-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcams-process.c
76 lines (62 loc) · 1.9 KB
/
cams-process.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <stdio.h>
#include <eccodes.h>
#include <getopt.h>
//#include <gdal/gdal.h>
#include "src/gributils.h"
#ifdef DEBUG
#define NO_GETOPT_ERROR_OUTPUT 0
#else
#define NO_GETOPT_ERROR_OUTPUT 1
#endif // DEBUG
int main(int argc, char *argv[]) {
static struct PROCESS_OPTIONS options = {0};
int optid, long_index = 0;
opterr = NO_GETOPT_ERROR_OUTPUT;
static struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"purpose", no_argument, NULL, 'i'},
{"version", no_argument, NULL, 'v'},
{"daily_tables", no_argument, &options.daily_tables, 1},
{"climatology", no_argument, &options.climatology, 1},
{"gtiff", no_argument, &options.convert_to_tiff, 1},
{0, 0, 0, 0}
};
while ((optid = getopt_long(argc, argv, "+:hivtcg", long_options, &long_index)) != -1) {
switch (optid) {
case 'h':
print_usage();
exit(EXIT_SUCCESS);
case 'i':
print_purpose();
exit(EXIT_SUCCESS);
case 'v':
print_version();
exit(EXIT_SUCCESS);
case 't': // fallthrough
case 'c': // fallthrough
case 'g': // fallthrough
case 0:
break;
case '?':
fprintf(stderr, "ERROR parsing option %c\n", optopt);
break;
default:
fprintf(stderr, "ERROR: Unreachable!\n");
exit(EXIT_FAILURE);
}
}
if (optind < argc) {
options.in_file = argv[optind++];
options.out_dir = argv[optind];
} else {
fprintf(stderr, "ERROR: Either in_file, out_dir or both not specified after arguments\n");
exit(EXIT_FAILURE);
}
if (options.daily_tables) {
}
if (options.climatology) {
}
if (options.convert_to_tiff) {
}
return 0;
}