-
Notifications
You must be signed in to change notification settings - Fork 0
/
vrgtest5.c
45 lines (32 loc) · 1 KB
/
vrgtest5.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
#define VRGCLI
#include "vrg.h"
// CHeck if the both -t and -b are specified
int check_t_or_b(char *arg)
{
static int found = 0;
if (found == 1) vrgerror("Invalid '%s' argument. Only one between '-t' and '-b' can be specified.\n", arg);
found = 1;
return 1;
}
int main (int argc, char *argv[])
{
vrgcli("version: 1.3RC\n Demo for the vrgli function") {
vrgarg("model\tModel file") {
printf("model: '%s'\n",vrgarg);
}
vrgarg("-h, --help\tPrint this help") {
vrgusage();
}
vrgarg("-b, --binary filename\tUse the binary format (mutually exclusive with '-t')",check_t_or_b) {
printf("Binary format: '%s'\n",vrgarg);
}
vrgarg("-t, --text filename\tUse the text format (mutually exclusive with '-b')",check_t_or_b) {
printf("Text format '%s'\n",vrgarg);
}
vrgarg() {
if (vrgarg[0] == '-') vrgerror("Unknown option '%s'\n",vrgarg);
else printf("Other argument %s\n",vrgarg);
}
}
fprintf(stderr,"Args left: %d\n", argc - vrgargn);
}