Released version 3-2014052800
[notion.git] / libtu / tester3.c
blob12bda855654b995bd643258d26cd586aeb734cc6
1 /*
2 * libtu/tester3.c
4 * Copyright (c) Tuomo Valkonen 1999-2002.
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.
8 */
10 #include <stdio.h>
12 #include "util.h"
13 #include "misc.h"
14 #include "optparser.h"
17 static const char usage[]=
18 "Usage: $p [options]\n"
19 "\n"
20 "Where options are:\n"
21 "$o\n";
24 static OptParserOpt opts[]={
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}
33 static OptParserCommonInfo tester3_cinfo={
34 NULL,
35 usage,
36 NULL
40 int main(int argc, char *argv[])
42 int opt;
44 libtu_init(argv[0]);
46 optparser_init(argc, argv, OPTP_NO_DASH, opts, &tester3_cinfo);
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;
70 return 0;