tester3.c

Mon, 17 Jan 2005 22:02:09 +0100

author
tuomov
date
Mon, 17 Jan 2005 22:02:09 +0100
changeset 85
9f94b2e96e3b
parent 70
e866dc825481
permissions
-rw-r--r--

trunk: changeset 1934
Fixed everything that requires locale stuff to check CF_NO_LOCALE.

0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
1 /*
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
2 * libtu/tester3.c
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
3 *
36
63cd573ffbcf trunk: changeset 39
tuomov
parents: 17
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2002.
53
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
5 *
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
6 * You may distribute and modify this library under the terms of either
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
8 */
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
9
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
10 #include <stdio.h>
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents: 3
diff changeset
11
70
e866dc825481 trunk: changeset 1408
tuomov
parents: 62
diff changeset
12 #include "util.h"
e866dc825481 trunk: changeset 1408
tuomov
parents: 62
diff changeset
13 #include "misc.h"
e866dc825481 trunk: changeset 1408
tuomov
parents: 62
diff changeset
14 #include "optparser.h"
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
15
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
16
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
17 static const char usage[]=
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
18 "Usage: $p [options]\n"
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
19 "\n"
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
20 "Where options are:\n"
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
21 "$o\n";
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
22
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
23
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
24 static OptParserOpt opts[]={
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
25 {'o', "opt", OPT_ARG, "OPTION", "foo bar baz quk asdf jklö äölk dfgh quik aaaa bbbb cccc dddd eeee ffff"},
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
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"},
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
27 {'v', "view", 0, NULL, "asfasdf"},
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
28 {'z', "zip", 0, NULL, "asdfasdf"},
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
29 {'x', "extract", 0, NULL, "asdfasdf"},
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
30 {0, NULL, 0, NULL, NULL}
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
31 };
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
32
17
a034888a2227 trunk: changeset 20
tuomov
parents: 12
diff changeset
33 static OptParserCommonInfo tester3_cinfo={
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
34 NULL,
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
35 usage,
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
36 NULL
17
a034888a2227 trunk: changeset 20
tuomov
parents: 12
diff changeset
37 };
a034888a2227 trunk: changeset 20
tuomov
parents: 12
diff changeset
38
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
39
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
40 int main(int argc, char *argv[])
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
41 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
42 int opt;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
43
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
44 libtu_init(argv[0]);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
45
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
46 optparser_init(argc, argv, OPTP_NO_DASH, opts, &tester3_cinfo);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
47
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
48 while((opt=optparser_get_opt())){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
49 switch(opt){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
50 case 'o':
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
51 printf("opt: %s\n", optparser_get_arg());
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
52 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
53 case 'f':
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
54 printf("file: %s\n", optparser_get_arg());
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
55 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
56 case 'v':
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
57 printf("view\n");
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
58 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
59 case 'z':
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
60 printf("zip\n");
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
61 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
62 case 'x':
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
63 printf("extract\n");
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
64 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
65 default:
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
66 optparser_print_error();
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
67 return 1;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
68 }
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
69 }
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
70 return 0;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
71 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
72

mercurial