]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Add help text for actions.
authorjamal <hadi@cyberus.ca>
Fri, 4 Aug 2006 17:59:34 +0000 (10:59 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Fri, 4 Aug 2006 17:59:34 +0000 (10:59 -0700)
tc/m_action.c
tc/m_gact.c

index 2d2b0edbd9477621e89ac0e4266b67666ad77d98..b4eff91c727f1cf379c1b8c783fe43b307191cae 100644 (file)
@@ -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 <ACTSPECOP>*\n");
+       fprintf(stderr,
+               "Where: \tACTSPECOP := ACR | GD | FL\n"
+               "\tACR := add | change | replace <ACTSPEC>* \n"
+               "\tGD := get | delete | <ACTISPEC>*\n"
+               "\tFL := ls | list | flush | <ACTNAMESPEC>\n"
+               "\tACTNAMESPEC :=  action <ACTNAME>\n"
+               "\tACTISPEC := <ACTNAMESPEC> <INDEXSPEC>\n"
+               "\tACTSPEC := action <ACTDETAIL> [INDEXSPEC]\n"
+               "\tINDEXSPEC := index <32 bit indexvalue>\n"
+               "\tACTDETAIL := <ACTNAME> <ACTPARAMS>\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;
                }
        }
index 4bb50410fa9992108025f8e07df44500b3c3176f..3ad872af5dc574f2192da14a2afbc98e8a6355fb 100644 (file)
@@ -46,17 +46,17 @@ explain(void)
        fprintf(stderr, "Usage: ... gact <ACTION> [RAND] [INDEX]\n");
        fprintf(stderr,
                "Where: ACTION := reclassify | drop | continue | pass "
-                       "RAND := random <RANDTYPE> <ACTION> <VAL>"
-                       "RANDTYPE := netrand | determ"
-                       "VAL : = value not exceeding 10000"
-                       "INDEX := index value used"
-                       "\n");
+               "RAND := random <RANDTYPE> <ACTION> <VAL>"
+               "RANDTYPE := netrand | determ"
+               "VAL : = value not exceeding 10000"
+               "INDEX := index value used"
+               "\n");
 #else
        fprintf(stderr, "Usage: ... gact <ACTION> [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();
                }
        }