gitweb: Add charset info to "raw" output of 'text/plain' blobs
[git/jnareb-git/bp-gitweb.git] / test-parse-options.c
blob73360d75126af2f231b3cfdad26a47e18fff0a39
1 #include "cache.h"
2 #include "parse-options.h"
4 static int boolean = 0;
5 static int integer = 0;
6 static char *string = NULL;
8 int main(int argc, const char **argv)
10 const char *usage[] = {
11 "test-parse-options <options>",
12 NULL
14 struct option options[] = {
15 OPT_BOOLEAN('b', "boolean", &boolean, "get a boolean"),
16 OPT_INTEGER('i', "integer", &integer, "get a integer"),
17 OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
18 OPT_GROUP("string options"),
19 OPT_STRING('s', "string", &string, "string", "get a string"),
20 OPT_STRING(0, "string2", &string, "str", "get another string"),
21 OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
22 OPT_STRING('o', NULL, &string, "str", "get another string"),
23 OPT_GROUP("magic arguments"),
24 OPT_ARGUMENT("quux", "means --quux"),
25 OPT_END(),
27 int i;
29 argc = parse_options(argc, argv, options, usage, 0);
31 printf("boolean: %d\n", boolean);
32 printf("integer: %d\n", integer);
33 printf("string: %s\n", string ? string : "(not set)");
35 for (i = 0; i < argc; i++)
36 printf("arg %02d: %s\n", i, argv[i]);
38 return 0;