20 |
20 |
21 |
21 |
22 static OptParserOpt opts[]={ |
22 static OptParserOpt opts[]={ |
23 {'o', "opt", OPT_ARG, "OPTION", "foo bar baz quk asdf jklö äölk dfgh quik aaaa bbbb cccc dddd eeee ffff"}, |
23 {'o', "opt", OPT_ARG, "OPTION", "foo bar baz quk asdf jklö äölk dfgh quik aaaa bbbb cccc dddd eeee ffff"}, |
24 {'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"}, |
24 {'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"}, |
25 {'v', "view", 0, NULL, NULL}, |
25 {'v', "view", 0, NULL, "asfasdf"}, |
26 {'z', "zip", 0, NULL, NULL}, |
26 {'z', "zip", 0, NULL, "asdfasdf"}, |
27 {'x', "extract", 0, NULL, NULL}, |
27 {'x', "extract", 0, NULL, "asdfasdf"}, |
28 {0, NULL, 0, NULL, NULL} |
28 {0, NULL, 0, NULL, NULL} |
29 }; |
29 }; |
30 |
30 |
|
31 static OptParserCommonInfo tester3_cinfo={ |
|
32 NULL, |
|
33 usage, |
|
34 NULL |
|
35 }; |
|
36 |
31 |
37 |
32 int main(int argc, char *argv[]) |
38 int main(int argc, char *argv[]) |
33 { |
39 { |
34 int opt; |
40 int opt; |
35 |
41 |
36 libtu_init(argv[0]); |
42 libtu_init(argv[0]); |
37 |
43 |
38 optparser_init(argc, argv, OPTP_NO_DASH, opts, NULL); |
44 optparser_init(argc, argv, OPTP_NO_DASH, opts, &tester3_cinfo); |
39 |
45 |
40 while((opt=optparser_get_opt())){ |
46 while((opt=optparser_get_opt())){ |
41 switch(opt){ |
47 switch(opt){ |
42 case 'o': |
48 case 'o': |
43 printf("opt: %s\n", optparser_get_arg()); |
49 printf("opt: %s\n", optparser_get_arg()); |