fix output for local connections
Modified: trunk/reactos/apps/utils/net/netstat/netstat.c
Modified: trunk/reactos/apps/utils/net/netstat/netstat.h
_____
Modified: trunk/reactos/apps/utils/net/netstat/netstat.c
--- trunk/reactos/apps/utils/net/netstat/netstat.c 2005-12-20
20:34:03 UTC (rev 20278)
+++ trunk/reactos/apps/utils/net/netstat/netstat.c 2005-12-20
20:36:38 UTC (rev 20279)
@@ -125,6 +125,9 @@
case 'a' :
bDoShowAllCons = TRUE;
break;
+ case 'b' :
+ bDoShowProcName = TRUE;
+ break;
case 'e' :
bDoShowEthStats = TRUE;
break;
@@ -198,9 +201,9 @@
if (bDoShowRouteTable)
{
+ /* mingw doesn't have lib for _tsystem */
if (system("route print") == -1)
{
- //mingw doesn't have lib for _tsystem
_tprintf(_T("cannot find 'route.exe'\n"));
return EXIT_FAILURE;
}
@@ -574,7 +577,7 @@
return Name;
}
- Name[0] = L'\0';
+ Name[0] = _T('\0');
// Try to translate to a name
if (!IpAddr) {
@@ -585,11 +588,12 @@
(nIpAddr >> 8) & 0xFF,
(nIpAddr) & 0xFF);
} else {
- //gethostname(name, namelen);
+ gethostname(Name, NameLen);
}
} else if (IpAddr == 0x0100007f) {
if (Local) {
- //gethostname(name, namelen);
+ if (gethostname(Name, NameLen) != 0)
+ DoFormatMessage(WSAGetLastError());
} else {
strcpy(Name, "localhost");
}
@@ -627,7 +631,6 @@
-
/*
*
* Parse command line parameters and set any options
@@ -636,6 +639,14 @@
*/
int main(int argc, char *argv[])
{
+ WSADATA wsaData;
+
+ if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
+ {
+ _tprintf(_T("WSAStartup() failed : %d\n"), WSAGetLastError());
+ return -1;
+ }
+
if (ParseCmdline(argc, argv))
return -1;
_____
Modified: trunk/reactos/apps/utils/net/netstat/netstat.h
--- trunk/reactos/apps/utils/net/netstat/netstat.h 2005-12-20
20:34:03 UTC (rev 20278)
+++ trunk/reactos/apps/utils/net/netstat/netstat.h 2005-12-20
20:36:38 UTC (rev 20279)
@@ -7,6 +7,7 @@
/* command line options */
BOOL bNoOptions = FALSE; // print default
BOOL bDoShowAllCons = FALSE; // -a
+BOOL bDoShowProcName = FALSE; // -b
BOOL bDoShowEthStats = FALSE; // -e
BOOL bDoShowNumbers = FALSE; // -n
BOOL bDoShowProtoCons = FALSE; // -p
Show replies by date