diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-05-31 16:57:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-31 16:57:42 -0700 |
commit | f9275c68af58e0f65e1557b5109ccbfdbbbc384a (patch) | |
tree | 7479d66d97277f47490de10e204cfcbc0a123885 /test-parse-options.c | |
parent | 714cdcd03e2caac6e2dc8d94debc7c800742f546 (diff) | |
parent | df217ed6430efe444a09fffdafd39720ae3f9864 (diff) | |
download | git-f9275c68af58e0f65e1557b5109ccbfdbbbc384a.tar.gz git-f9275c68af58e0f65e1557b5109ccbfdbbbc384a.tar.xz |
Merge branch 'sb/opt-filename'
* sb/opt-filename:
parse-opts: add OPT_FILENAME and transition builtins
parse-opts: prepare for OPT_FILENAME
Conflicts:
builtin-log.c
Diffstat (limited to 'test-parse-options.c')
-rw-r--r-- | test-parse-options.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test-parse-options.c b/test-parse-options.c index e0669dcb4..a90bc3003 100644 --- a/test-parse-options.c +++ b/test-parse-options.c @@ -7,6 +7,7 @@ static unsigned long timestamp; static int abbrev = 7; static int verbose = 0, dry_run = 0, quiet = 0; static char *string = NULL; +static char *file = NULL; int length_callback(const struct option *opt, const char *arg, int unset) { @@ -27,6 +28,7 @@ int number_callback(const struct option *opt, const char *arg, int unset) int main(int argc, const char **argv) { + const char *prefix = "prefix/"; const char *usage[] = { "test-parse-options <options>", NULL @@ -43,6 +45,7 @@ int main(int argc, const char **argv) OPT_DATE('t', NULL, ×tamp, "get timestamp of <time>"), OPT_CALLBACK('L', "length", &integer, "str", "get length of <str>", length_callback), + OPT_FILENAME('F', "file", &file, "set file to <FILE>"), OPT_GROUP("String options"), OPT_STRING('s', "string", &string, "string", "get a string"), OPT_STRING(0, "string2", &string, "str", "get another string"), @@ -65,7 +68,7 @@ int main(int argc, const char **argv) }; int i; - argc = parse_options(argc, argv, options, usage, 0); + argc = parse_options(argc, argv, prefix, options, usage, 0); printf("boolean: %d\n", boolean); printf("integer: %u\n", integer); @@ -75,6 +78,7 @@ int main(int argc, const char **argv) printf("verbose: %d\n", verbose); printf("quiet: %s\n", quiet ? "yes" : "no"); printf("dry run: %s\n", dry_run ? "yes" : "no"); + printf("file: %s\n", file ? file : "(not set)"); for (i = 0; i < argc; i++) printf("arg %02d: %s\n", i, argv[i]); |