From: jamal Date: Fri, 4 Aug 2006 17:59:34 +0000 (-0700) Subject: Add help text for actions. X-Git-Tag: v2.6.19-061214~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1e4f042a5bb36538702cd4f0471149ff06c7a15;p=thirdparty%2Fiproute2.git Add help text for actions. --- diff --git a/tc/m_action.c b/tc/m_action.c index 2d2b0edbd..b4eff91c7 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -37,7 +37,27 @@ 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"); } static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt) @@ -598,7 +618,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 4bb50410f..3ad872af5 100644 --- a/tc/m_gact.c +++ b/tc/m_gact.c @@ -46,17 +46,17 @@ explain(void) fprintf(stderr, "Usage: ... gact [RAND] [INDEX]\n"); fprintf(stderr, "Where: ACTION := reclassify | drop | continue | pass " - "RAND := random " - "RANDTYPE := netrand | determ" - "VAL : = value not exceeding 10000" - "INDEX := index value used" - "\n"); + "RAND := random " + "RANDTYPE := netrand | determ" + "VAL : = value not exceeding 10000" + "INDEX := index value used" + "\n"); #else fprintf(stderr, "Usage: ... gact [INDEX]\n"); fprintf(stderr, "Where: ACTION := reclassify | drop | continue | pass " "INDEX := index value used" - "\n"); + "\n"); #endif } @@ -171,6 +171,8 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struc argc--; argv++; ok++; + } else if (matches(*argv, "help") == 0) { + usage(); } }