]> git.decadent.org.uk Git - ion3.git/blob - libtu/tester3.c
[svn-inject] Installing original source of ion3
[ion3.git] / libtu / tester3.c
1 /*
2  * libtu/tester3.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2002. 
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.
8  */
9
10 #include <stdio.h>
11
12 #include "util.h"
13 #include "misc.h"
14 #include "optparser.h"
15
16
17 static const char usage[]=
18     "Usage: $p [options]\n"
19     "\n"
20     "Where options are:\n"
21     "$o\n";
22     
23
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}
31 };
32     
33 static OptParserCommonInfo tester3_cinfo={
34     NULL,
35     usage,
36     NULL
37 };
38
39
40 int main(int argc, char *argv[])
41 {
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;
71 }
72