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