Add explicit help text for actions --- commit 87d5ee5fddd9476bd720ea339f6ddb237d6eb99c tree 1888b85dbb7a724df0a215c7f1a07b857a3cd00b parent e2e0fac73a39bc6878f93cd7698f4c823ef85546 author Jamal Hadi Salim Sun, 30 Jul 2006 20:00:37 -0400 committer Jamal Hadi Salim Sun, 30 Jul 2006 20:00:37 -0400 tc/m_action.c | 25 +++++++++++++++++++++++-- tc/m_gact.c | 4 +++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/tc/m_action.c b/tc/m_action.c index c612069..3808a86 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -37,7 +37,28 @@ int tab_flush = 0; void act_usage(void) { - fprintf (stderr, "action usage improper\n"); + /*XXX: In the near future add a action->print_help to improve + * usability + * This would mean new tc will not be backward compatible + * with any action .so from the old days. But if someone really + * does that, they would know how to fix this .. + * + */ + fprintf (stderr, "usage: tc actions *\n"); + fprintf(stderr, + "Where: \tACTSPECOP := ACR | GD | FL\n" + "\tACR := add | change | replace * \n" + "\tGD := get | delete | *\n" + "\tFL := ls | list | flush | \n" + "\tACTNAMESPEC := action \n" + "\tACTISPEC := \n" + "\tACTSPEC := action [INDEXSPEC]\n" + "\tINDEXSPEC := index <32 bit indexvalue>\n" + "\tACTDETAIL := \n" + "\t\tExample ACTNAME is gact, mirred etc\n" + "\t\tEach action has its own parameters (ACTPARAMS)\n" + "\n"); + exit(-1); } @@ -599,7 +620,7 @@ int do_action(int argc, char **argv) } if (ret < 0) { - fprintf(stderr, "Command \"%s\" is unknown, try \"tc action help\".\n", *argv); + fprintf(stderr, "Command \"%s\" is unknown, try \"tc actions help\".\n", *argv); return -1; } } diff --git a/tc/m_gact.c b/tc/m_gact.c index 4e3f3c7..cfbaf87 100644 --- a/tc/m_gact.c +++ b/tc/m_gact.c @@ -56,7 +56,7 @@ #else fprintf(stderr, "Where: \tACTION := reclassify | drop | continue | pass \n" "\tINDEX := index value used\n" - "\n"); + "\n"); #endif } @@ -179,6 +179,8 @@ #endif argc--; argv++; ok++; + } else if (matches(*argv, "help") == 0) { + usage(); } }