diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:13 -0700 |
commit | e12b51e4d685c30f488c99c5d89f3310c3fcd9b0 (patch) | |
tree | 57edea5f304464e3865ffecc6fb475b41f2fa0e8 /test-parse-options.c | |
parent | ba12cb299f831f29c256c644b01108710c2629e6 (diff) | |
parent | 2a514ed8058e35841d3d7b05a898991b83e5eaf0 (diff) | |
download | git-e12b51e4d685c30f488c99c5d89f3310c3fcd9b0.tar.gz |
Merge branch 'cb/parse-magnitude'
Move machinery to parse human-readable scaled numbers like 1k, 4M,
and 2G as an option parameter's value from pack-objects to
parse-options API, to make it available to other codepaths.
* cb/parse-magnitude:
parse-options: move unsigned long option parsing out of pack-objects.c
test-parse-options: update to handle negative ints
Diffstat (limited to 'test-parse-options.c')
-rw-r--r-- | test-parse-options.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test-parse-options.c b/test-parse-options.c index 5dabce60f3..2c8c8f18ed 100644 --- a/test-parse-options.c +++ b/test-parse-options.c @@ -4,6 +4,7 @@ static int boolean = 0; static int integer = 0; +static unsigned long magnitude = 0; static unsigned long timestamp; static int abbrev = 7; static int verbose = 0, dry_run = 0, quiet = 0; @@ -48,6 +49,7 @@ int main(int argc, char **argv) OPT_GROUP(""), OPT_INTEGER('i', "integer", &integer, "get a integer"), OPT_INTEGER('j', NULL, &integer, "get a integer, too"), + OPT_MAGNITUDE('m', "magnitude", &magnitude, "get a magnitude"), OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23), OPT_DATE('t', NULL, ×tamp, "get timestamp of <time>"), OPT_CALLBACK('L', "length", &integer, "str", @@ -82,7 +84,8 @@ int main(int argc, char **argv) argc = parse_options(argc, (const char **)argv, prefix, options, usage, 0); printf("boolean: %d\n", boolean); - printf("integer: %u\n", integer); + printf("integer: %d\n", integer); + printf("magnitude: %lu\n", magnitude); printf("timestamp: %lu\n", timestamp); printf("string: %s\n", string ? string : "(not set)"); printf("abbrev: %d\n", abbrev); |