From 81af4460f352aa4a1b5d4cbbe50ef48dcb68b527 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Fri, 12 Apr 2013 17:18:25 +0930 Subject: [PATCH] Fix broken "ping" command arg parsing --- cli.c | 22 +++++++++++++--------- commandline.c | 11 +++++++---- tests/routing | 6 ++++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/cli.c b/cli.c index 0477bcf6..300c25de 100644 --- a/cli.c +++ b/cli.c @@ -52,7 +52,7 @@ int cli_usage_args(const int argc, const char *const *args, const struct cli_sch if (matched) { matched_any = 1; for (opt = 0; (word = commands[cmd].words[opt]); ++opt) { - if (word[0] == '\\') + if (word[0] == '|') ++word; xprintf(xpf, " %s", word); } @@ -116,8 +116,8 @@ int cli_parse(const int argc, const char *const *args, const struct cli_schema * * or "wordN", labels it with the matched word (an empty alternative, eg "|word" does not * match an empty argument) * - * (as a result of the above rule, "|word" or "word|" or "|word|" consumes one argument that - * exactly matches "word" and labels it "word") + * (as a special case of the above rule, "|word" consumes one argument that exactly matches + * "word" and labels it "word", but it appears in the help description as "word") * * "