lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 | strcmp(progname, "iptables-static") == 0) |
| 22 | return iptables_main(argc, argv); |
| 23 | |
| 24 | if (!strcmp(progname, "iptables-save")) |
| 25 | return iptables_save_main(argc, argv); |
| 26 | |
| 27 | if (!strcmp(progname, "iptables-restore")) |
| 28 | return iptables_restore_main(argc, argv); |
| 29 | |
| 30 | if (!strcmp(progname, "iptables-xml")) |
| 31 | return iptables_xml_main(argc, argv); |
| 32 | |
| 33 | fprintf(stderr, "iptables multi-purpose version: unknown applet name %s\n", progname); |
| 34 | exit(1); |
| 35 | } |
| 36 | } |