Commit 6158a5cc authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

netstat: Implement -a option.

parent a422d6b3
...@@ -145,7 +145,7 @@ static WCHAR *NETSTAT_host_name(UINT ip, WCHAR name[]) ...@@ -145,7 +145,7 @@ static WCHAR *NETSTAT_host_name(UINT ip, WCHAR name[])
return name; return name;
} }
static void NETSTAT_tcp_header(void) static void NETSTAT_conn_header(void)
{ {
WCHAR local[22], remote[22], state[22]; WCHAR local[22], remote[22], state[22];
NETSTAT_wprintf(fmtnn, NETSTAT_load_message(IDS_TCP_ACTIVE_CONN)); NETSTAT_wprintf(fmtnn, NETSTAT_load_message(IDS_TCP_ACTIVE_CONN));
...@@ -175,8 +175,6 @@ static void NETSTAT_tcp_table(void) ...@@ -175,8 +175,6 @@ static void NETSTAT_tcp_table(void)
if (err) return; if (err) return;
NETSTAT_tcp_header();
for (i = 0; i < table->dwNumEntries; i++) for (i = 0; i < table->dwNumEntries; i++)
{ {
if ((table->table[i].u.dwState == MIB_TCP_STATE_CLOSE_WAIT) || if ((table->table[i].u.dwState == MIB_TCP_STATE_CLOSE_WAIT) ||
...@@ -213,8 +211,6 @@ static void NETSTAT_udp_table(void) ...@@ -213,8 +211,6 @@ static void NETSTAT_udp_table(void)
if (err) return; if (err) return;
NETSTAT_tcp_header();
for (i = 0; i < table->dwNumEntries; i++) for (i = 0; i < table->dwNumEntries; i++)
{ {
NETSTAT_host_name(table->table[i].dwLocalAddr, HostIp); NETSTAT_host_name(table->table[i].dwLocalAddr, HostIp);
...@@ -252,6 +248,7 @@ int wmain(int argc, WCHAR *argv[]) ...@@ -252,6 +248,7 @@ int wmain(int argc, WCHAR *argv[])
if (argc == 1) if (argc == 1)
{ {
/* No options */ /* No options */
NETSTAT_conn_header();
NETSTAT_tcp_table(); NETSTAT_tcp_table();
return 0; return 0;
} }
...@@ -260,21 +257,28 @@ int wmain(int argc, WCHAR *argv[]) ...@@ -260,21 +257,28 @@ int wmain(int argc, WCHAR *argv[])
{ {
switch (argv[1][1]) switch (argv[1][1])
{ {
case 'a':
NETSTAT_conn_header();
NETSTAT_tcp_table();
NETSTAT_udp_table();
return 0;
case 'p': case 'p':
argv++; argc--; argv++; argc--;
if (argc == 1) return 1; if (argc == 1) return 1;
switch (NETSTAT_get_protocol(argv[1])) switch (NETSTAT_get_protocol(argv[1]))
{ {
case PROT_TCP: case PROT_TCP:
NETSTAT_conn_header();
NETSTAT_tcp_table(); NETSTAT_tcp_table();
break; break;
case PROT_UDP: case PROT_UDP:
NETSTAT_conn_header();
NETSTAT_udp_table(); NETSTAT_udp_table();
break; break;
default: default:
WINE_FIXME("Protocol not yet implemented: %s\n", debugstr_w(argv[1])); WINE_FIXME("Protocol not yet implemented: %s\n", debugstr_w(argv[1]));
} }
break; return 0;
default: default:
WINE_FIXME("Unknown option: %s\n", debugstr_w(argv[1])); WINE_FIXME("Unknown option: %s\n", debugstr_w(argv[1]));
return 1; return 1;
......
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