]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
When compiled static, don't show help-messages for all matches and targets,
authorMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 15:41:54 +0000 (15:41 +0000)
committerMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 15:41:54 +0000 (15:41 +0000)
only show help for specified ones.

ip6tables.c
iptables.c

index b2816bad7202c39957cb138631030d2a4121f3d4..ee42c087dbc81e735bc3342babce77b42735d7b4 100644 (file)
@@ -292,9 +292,9 @@ exit_tryhelp(int status)
 }
 
 void
-exit_printhelp(void)
+exit_printhelp(struct ip6tables_rule_match *matches)
 {
-       struct ip6tables_match *m = NULL;
+       struct ip6tables_rule_match *matchp = NULL;
        struct ip6tables_target *t = NULL;
 
        printf("%s v%s\n\n"
@@ -359,14 +359,16 @@ exit_printhelp(void)
 
        /* Print out any special helps. A user might like to be able to add a --help 
           to the commandline, and see expected results. So we call help for all 
-          matches & targets */
-       for (t=ip6tables_targets;t;t=t->next) {
-               printf("\n");
-               t->help();
+          specified matches & targets */
+       for (t = ip6tables_targets; t; t = t->next) {
+               if (t->used) {
+                       printf("\n");
+                       t->help();
+               }
        }
-       for (m=ip6tables_matches;m;m=m->next) {
+       for (matchp = matches; matchp; matchp = matchp->next) {
                printf("\n");
-               m->help();
+               matchp->match->help();
        }
        exit(0);
 }
@@ -1839,10 +1841,10 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
                                optarg = argv[optind];
 
                        /* iptables -p icmp -h */
-                       if (!ip6tables_matches && protocol)
-                               find_match(protocol, TRY_LOAD, NULL);
+                       if (!matches && protocol)
+                               find_match(protocol, TRY_LOAD, &matches);
 
-                       exit_printhelp();
+                       exit_printhelp(matches);
 
                        /*
                         * Option selection
index bec912f4db0cc27cab04669ebe3d39514e282484..648f988f2bb67ce443d5131a9535199b797e2461 100644 (file)
@@ -346,9 +346,9 @@ exit_tryhelp(int status)
 }
 
 void
-exit_printhelp(void)
+exit_printhelp(struct iptables_rule_match *matches)
 {
-       struct iptables_match *m = NULL;
+       struct iptables_rule_match *matchp = NULL;
        struct iptables_target *t = NULL;
 
        printf("%s v%s\n\n"
@@ -413,14 +413,16 @@ exit_printhelp(void)
 
        /* Print out any special helps. A user might like to be able
           to add a --help to the commandline, and see expected
-          results. So we call help for all matches & targets */
-       for (t=iptables_targets;t;t=t->next) {
-               printf("\n");
-               t->help();
+          results. So we call help for all specified matches & targets */
+       for (t = iptables_targets; t ;t = t->next) {
+               if (t->used) {
+                       printf("\n");
+                       t->help();
+               }
        }
-       for (m=iptables_matches;m;m=m->next) {
+       for (matchp = matches; matchp; matchp = matchp->next) {
                printf("\n");
-               m->help();
+               matchp->match->help();
        }
        exit(0);
 }
@@ -1836,10 +1838,10 @@ int do_command(int argc, char *argv[], char **table, iptc_handle_t *handle)
                                optarg = argv[optind];
 
                        /* iptables -p icmp -h */
-                       if (!iptables_matches && protocol)
-                               find_match(protocol, TRY_LOAD, NULL);
+                       if (!matches && protocol)
+                               find_match(protocol, TRY_LOAD, &matches);
 
-                       exit_printhelp();
+                       exit_printhelp(matches);
 
                        /*
                         * Option selection