Sat, 29 Apr 2000 15:35:45 +0200
trunk: changeset 12
Changed the copyright notice in headers
0 | 1 | /* |
2 | * libtu/tester3.c | |
3 | * | |
9 | 4 | * Copyright (c) Tuomo Valkonen 1999-2000. |
0 | 5 | * See the included file LICENSE for details. |
6 | */ | |
7 | ||
8 | #include <stdio.h> | |
5 | 9 | |
10 | #include <libtu/util.h> | |
11 | #include <libtu/misc.h> | |
12 | #include <libtu/optparser.h> | |
0 | 13 | |
14 | ||
15 | static const char usage[]= | |
16 | "$u [options]\n" | |
17 | "\n" | |
18 | "Where options are:\n" | |
19 | "\n" | |
20 | " -o, -f, -v, -z, -x\n" | |
21 | "$c \n" | |
22 | "\n"; | |
23 | ||
24 | ||
25 | static ProgInfo proginfo={ | |
26 | "Tester III", | |
27 | "0.1", | |
28 | "foo", | |
29 | "bar", | |
30 | usage | |
31 | }; | |
32 | ||
33 | ||
34 | static OptParserOpt opts[]={ | |
3 | 35 | {'o', "opt", OPT_ARG}, |
36 | {'f', "file", OPT_ARG}, | |
37 | {'v', "view", 0}, | |
38 | {'z', "zip", 0}, | |
39 | {'x', "extract", 0}, | |
0 | 40 | {0, NULL, 0} |
41 | }; | |
42 | ||
43 | ||
44 | int main(int argc, char *argv[]) | |
45 | { | |
46 | int opt; | |
47 | ||
48 | libtu_init(&argc, argv, &proginfo); | |
49 | ||
3 | 50 | optparser_init(argc, argv, OPTP_NO_DASH, opts); |
0 | 51 | |
52 | while((opt=optparser_get_opt())){ | |
53 | switch(opt){ | |
54 | case 'o': | |
55 | printf("opt: %s\n", optparser_get_arg()); | |
56 | break; | |
57 | case 'f': | |
58 | printf("file: %s\n", optparser_get_arg()); | |
59 | break; | |
60 | case 'v': | |
61 | printf("view\n"); | |
62 | break; | |
63 | case 'z': | |
64 | printf("zip\n"); | |
65 | break; | |
66 | case 'x': | |
67 | printf("extract\n"); | |
68 | break; | |
69 | default: | |
70 | optparser_print_error(); | |
71 | return 1; | |
72 | } | |
73 | } | |
74 | return 0; | |
75 | } | |
76 |