Home | History | Annotate | Download | only in iptables
      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <string.h>
      4 #include <libgen.h>
      5 
      6 int iptables_main(int argc, char **argv);
      7 int iptables_save_main(int argc, char **argv);
      8 int iptables_restore_main(int argc, char **argv);
      9 int iptables_xml_main(int argc, char **argv);
     10 
     11 int main(int argc, char **argv) {
     12   char *progname;
     13 
     14   if (argc == 0) {
     15     fprintf(stderr, "no argv[0]?");
     16     exit(1);
     17   } else {
     18     progname = basename(argv[0]);
     19 
     20     if (!strcmp(progname, "iptables"))
     21       return iptables_main(argc, argv);
     22 
     23     if (!strcmp(progname, "iptables-save"))
     24       return iptables_save_main(argc, argv);
     25 
     26     if (!strcmp(progname, "iptables-restore"))
     27       return iptables_restore_main(argc, argv);
     28 
     29     if (!strcmp(progname, "iptables-xml"))
     30       return iptables_xml_main(argc, argv);
     31 
     32     fprintf(stderr, "iptables multi-purpose version: unknown applet name %s\n", progname);
     33     exit(1);
     34   }
     35 }
     36