=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: netstat: Implement -a option.
Alexandre Julliard
julliard at winehq.org
Tue Jan 8 13:58:41 CST 2013
Module: wine
Branch: master
Commit: 6158a5ccf3c390840a6b071d52aa0d2d6866a1e7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6158a5ccf3c390840a6b071d52aa0d2d6866a1e7
Author: André Hentschel <nerv at dawncrow.de>
Date: Mon Jan 7 23:26:55 2013 +0100
netstat: Implement -a option.
---
programs/netstat/netstat.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/programs/netstat/netstat.c b/programs/netstat/netstat.c
index 4f29788..268cec1 100644
--- a/programs/netstat/netstat.c
+++ b/programs/netstat/netstat.c
@@ -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;
More information about the wine-cvs
mailing list