summaryrefslogtreecommitdiff
path: root/test-parse-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-30 19:53:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-30 19:53:45 (GMT)
commitc4aca9ccda51badb672ab70099863072d1567267 (patch)
treec69878ce9914b25e4eda1a476e560c0646f13f01 /test-parse-options.c
parent5354a56fe70420c147f930e0f7f1decbae685d19 (diff)
downloadgit-c4aca9ccda51badb672ab70099863072d1567267.zip
git-c4aca9ccda51badb672ab70099863072d1567267.tar.gz
git-c4aca9ccda51badb672ab70099863072d1567267.tar.bz2
Fix test-parse-options "integer" test
OPT_INTEGER() works on an integer, not on an unsigned long. On a big endian architecture with long larger than int, integer test gives bogus results because of this bug. Reported by H.Merijn Brand in HP-UX 64-bit environment. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-parse-options.c')
-rw-r--r--test-parse-options.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/test-parse-options.c b/test-parse-options.c
index 2a79e72..6e18083 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -2,7 +2,8 @@
#include "parse-options.h"
static int boolean = 0;
-static unsigned long integer = 0;
+static int integer = 0;
+static unsigned long timestamp;
static int abbrev = 7;
static int verbose = 0, dry_run = 0, quiet = 0;
static char *string = NULL;
@@ -32,7 +33,7 @@ int main(int argc, const char **argv)
OPT_INTEGER('i', "integer", &integer, "get a integer"),
OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23),
- OPT_DATE('t', NULL, &integer, "get timestamp of <time>"),
+ OPT_DATE('t', NULL, &timestamp, "get timestamp of <time>"),
OPT_CALLBACK('L', "length", &integer, "str",
"get length of <str>", length_callback),
OPT_GROUP("String options"),
@@ -56,7 +57,8 @@ int main(int argc, const char **argv)
argc = parse_options(argc, argv, options, usage, 0);
printf("boolean: %d\n", boolean);
- printf("integer: %lu\n", integer);
+ printf("integer: %u\n", integer);
+ printf("timestamp: %lu\n", timestamp);
printf("string: %s\n", string ? string : "(not set)");
printf("abbrev: %d\n", abbrev);
printf("verbose: %d\n", verbose);