Mon, 17 Jan 2005 22:02:09 +0100
trunk: changeset 1934
Fixed everything that requires locale stuff to check CF_NO_LOCALE.
0 | 1 | /* |
2 | * libtu/tester3.c | |
3 | * | |
36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
53 | 5 | * |
6 | * You may distribute and modify this library under the terms of either | |
7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
0 | 8 | */ |
9 | ||
10 | #include <stdio.h> | |
5 | 11 | |
70 | 12 | #include "util.h" |
13 | #include "misc.h" | |
14 | #include "optparser.h" | |
0 | 15 | |
16 | ||
17 | static const char usage[]= | |
62 | 18 | "Usage: $p [options]\n" |
19 | "\n" | |
20 | "Where options are:\n" | |
21 | "$o\n"; | |
22 | ||
0 | 23 | |
24 | static OptParserOpt opts[]={ | |
62 | 25 | {'o', "opt", OPT_ARG, "OPTION", "foo bar baz quk asdf jklö äölk dfgh quik aaaa bbbb cccc dddd eeee ffff"}, |
26 | {'f', "file", OPT_ARG, "FILE", "asdfsadlfölökjasdflökjasdflkjöasdflkjöas dlöfjkasdfölkjasdfölkjasdfasdflöjasdfkasödjlfkasdlföjasdölfjkölkasjdfasdfölkjasd asdöljfasöldf asdölfköasdlf asfdlök asdföljkadsfölasdfölasdölkfjasdölfasödlflöskflasdföaölsdf"}, | |
27 | {'v', "view", 0, NULL, "asfasdf"}, | |
28 | {'z', "zip", 0, NULL, "asdfasdf"}, | |
29 | {'x', "extract", 0, NULL, "asdfasdf"}, | |
30 | {0, NULL, 0, NULL, NULL} | |
0 | 31 | }; |
62 | 32 | |
17 | 33 | static OptParserCommonInfo tester3_cinfo={ |
62 | 34 | NULL, |
35 | usage, | |
36 | NULL | |
17 | 37 | }; |
38 | ||
0 | 39 | |
40 | int main(int argc, char *argv[]) | |
41 | { | |
62 | 42 | int opt; |
43 | ||
44 | libtu_init(argv[0]); | |
45 | ||
46 | optparser_init(argc, argv, OPTP_NO_DASH, opts, &tester3_cinfo); | |
47 | ||
48 | while((opt=optparser_get_opt())){ | |
49 | switch(opt){ | |
50 | case 'o': | |
51 | printf("opt: %s\n", optparser_get_arg()); | |
52 | break; | |
53 | case 'f': | |
54 | printf("file: %s\n", optparser_get_arg()); | |
55 | break; | |
56 | case 'v': | |
57 | printf("view\n"); | |
58 | break; | |
59 | case 'z': | |
60 | printf("zip\n"); | |
61 | break; | |
62 | case 'x': | |
63 | printf("extract\n"); | |
64 | break; | |
65 | default: | |
66 | optparser_print_error(); | |
67 | return 1; | |
68 | } | |
69 | } | |
70 | return 0; | |
0 | 71 | } |
72 |