summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/diff.c b/diff.c
index 6029f8d..8b65b03 100644
--- a/diff.c
+++ b/diff.c
@@ -4573,50 +4573,6 @@ void diff_setup_done(struct diff_options *options)
FREE_AND_NULL(options->parseopts);
}
-static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *val)
-{
- char c, *eq;
- int len;
-
- if (*arg != '-')
- return 0;
- c = *++arg;
- if (!c)
- return 0;
- if (c == arg_short) {
- c = *++arg;
- if (!c)
- return 1;
- if (val && isdigit(c)) {
- char *end;
- int n = strtoul(arg, &end, 10);
- if (*end)
- return 0;
- *val = n;
- return 1;
- }
- return 0;
- }
- if (c != '-')
- return 0;
- arg++;
- eq = strchrnul(arg, '=');
- len = eq - arg;
- if (!len || strncmp(arg, arg_long, len))
- return 0;
- if (*eq) {
- int n;
- char *end;
- if (!isdigit(*++eq))
- return 0;
- n = strtoul(eq, &end, 10);
- if (*end)
- return 0;
- *val = n;
- }
- return 1;
-}
-
int parse_long_opt(const char *opt, const char **argv,
const char **optarg)
{
@@ -5291,6 +5247,9 @@ static void prep_parse_options(struct diff_options *options)
OPT_CALLBACK_F(0, "no-prefix", options, NULL,
N_("do not show any source or destination prefix"),
PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_no_prefix),
+ OPT_INTEGER_F(0, "inter-hunk-context", &options->interhunkcontext,
+ N_("show context between diff hunks up to the specified number of lines"),
+ PARSE_OPT_NONEG),
OPT_CALLBACK_F(0, "output-indicator-new",
&options->output_indicators[OUTPUT_INDICATOR_NEW],
N_("<char>"),
@@ -5483,9 +5442,6 @@ int diff_opt_parse(struct diff_options *options,
}
/* misc options */
- else if (opt_arg(arg, '\0', "inter-hunk-context",
- &options->interhunkcontext))
- ;
else
return 0;
return 1;