Commit adf6f579 authored by Tomáš Odehnal's avatar Tomáš Odehnal Committed by Bernd Eckenfels

netstat: unrecognized option -> non-zero exit code

Signed-off-by: default avatarJiri Popelka <jpopelka@redhat.com>
parent 73cef8a8
...@@ -1926,7 +1926,7 @@ static void version(void) ...@@ -1926,7 +1926,7 @@ static void version(void)
} }
static void usage(void) static void usage(int rc)
{ {
fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n")); fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
...@@ -1964,7 +1964,7 @@ static void usage(void) ...@@ -1964,7 +1964,7 @@ static void usage(void)
fprintf(stderr, _(" <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); fprintf(stderr, _(" <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF);
fprintf(stderr, _(" List of possible address families (which support routing):\n")); fprintf(stderr, _(" List of possible address families (which support routing):\n"));
print_aflist(1); /* 1 = routeable */ print_aflist(1); /* 1 = routeable */
exit(E_USAGE); exit(rc);
} }
...@@ -2148,14 +2148,15 @@ int main ...@@ -2148,14 +2148,15 @@ int main
break; break;
case '?': case '?':
usage(E_OPTERR);
case 'h': case 'h':
usage(); usage(E_USAGE);
case 's': case 's':
flag_sta++; flag_sta++;
} }
if (flag_int + flag_rou + flag_mas + flag_sta > 1) if (flag_int + flag_rou + flag_mas + flag_sta > 1)
usage(); usage(E_OPTERR);
if ((flag_inet || flag_inet6 || flag_sta) && if ((flag_inet || flag_inet6 || flag_sta) &&
!(flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw)) !(flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment