Increment "arg" when a character is consumed, not just before consuming the next character. Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- diff.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 03cdabf..bc1e3c3 100644 --- a/diff.c +++ b/diff.c @@ -3358,14 +3358,13 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va char c, *eq; int len; - if (*arg != '-') + if (*arg++ != '-') return 0; - c = *++arg; + c = *arg++; if (!c) return 0; if (c == arg_short) { - c = *++arg; - if (!c) + if (!*arg) return 1; /* optional argument was missing */ if (convert_i(arg, 10, val)) die("The value for -%c must be a non-negative integer", arg_short); @@ -3373,7 +3372,6 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va } if (c != '-') return 0; - arg++; eq = strchrnul(arg, '='); len = eq - arg; if (!len || strncmp(arg, arg_long, len)) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html