summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1768905)
raw | patch | inline | side by side (parent: 1768905)
author | Michele Ballabio <barra_cuda@katamail.com> | |
Mon, 24 Mar 2008 14:02:21 +0000 (15:02 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 27 Mar 2008 20:55:15 +0000 (13:55 -0700) |
There are quite a few places that will need to call approxidate(),
when they'll adopt the parse-options system, so this patch adds the
function parse_opt_approxidate_cb(), used by OPT_DATE.
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when they'll adopt the parse-options system, so this patch adds the
function parse_opt_approxidate_cb(), used by OPT_DATE.
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c | patch | blob | history | |
parse-options.h | patch | blob | history |
diff --git a/parse-options.c b/parse-options.c
index 8e64316fe002fe90c58de61e4d6558ee4ad87157..e87cafbe4199acb39fd9113e4b5096de19a3a61c 100644 (file)
--- a/parse-options.c
+++ b/parse-options.c
*(int *)(opt->value) = v;
return 0;
}
+
+int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
+ int unset)
+{
+ *(unsigned long *)(opt->value) = approxidate(arg);
+ return 0;
+}
diff --git a/parse-options.h b/parse-options.h
index 1af62b0485f2760607b7d3bc3e0ebdca09a53ea4..4ee443dafe146f05d1fe2a46e7e39ca6fdd608f9 100644 (file)
--- a/parse-options.h
+++ b/parse-options.h
#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
+#define OPT_DATE(s, l, v, h) \
+ { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
+ parse_opt_approxidate_cb }
#define OPT_CALLBACK(s, l, v, a, h, f) \
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
/*----- some often used options -----*/
extern int parse_opt_abbrev_cb(const struct option *, const char *, int);
+extern int parse_opt_approxidate_cb(const struct option *, const char *, int);
#define OPT__VERBOSE(var) OPT_BOOLEAN('v', "verbose", (var), "be verbose")
#define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet")