svn path=/trunk/; revision=20279
case 'a' :
bDoShowAllCons = TRUE;
break;
case 'a' :
bDoShowAllCons = TRUE;
break;
+ case 'b' :
+ bDoShowProcName = TRUE;
+ break;
case 'e' :
bDoShowEthStats = TRUE;
break;
case 'e' :
bDoShowEthStats = TRUE;
break;
+ /* mingw doesn't have lib for _tsystem */
if (system("route print") == -1)
{
if (system("route print") == -1)
{
- //mingw doesn't have lib for _tsystem
_tprintf(_T("cannot find 'route.exe'\n"));
return EXIT_FAILURE;
}
_tprintf(_T("cannot find 'route.exe'\n"));
return EXIT_FAILURE;
}
// Try to translate to a name
if (!IpAddr) {
// Try to translate to a name
if (!IpAddr) {
(nIpAddr >> 8) & 0xFF,
(nIpAddr) & 0xFF);
} else {
(nIpAddr >> 8) & 0xFF,
(nIpAddr) & 0xFF);
} else {
- //gethostname(name, namelen);
+ gethostname(Name, NameLen);
}
} else if (IpAddr == 0x0100007f) {
if (Local) {
}
} else if (IpAddr == 0x0100007f) {
if (Local) {
- //gethostname(name, namelen);
+ if (gethostname(Name, NameLen) != 0)
+ DoFormatMessage(WSAGetLastError());
} else {
strcpy(Name, "localhost");
}
} else {
strcpy(Name, "localhost");
}
/*
*
* Parse command line parameters and set any options
/*
*
* Parse command line parameters and set any options
*/
int main(int argc, char *argv[])
{
*/
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;
if (ParseCmdline(argc, argv))
return -1;
/* command line options */
BOOL bNoOptions = FALSE; // print default
BOOL bDoShowAllCons = FALSE; // -a
/* 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
BOOL bDoShowEthStats = FALSE; // -e
BOOL bDoShowNumbers = FALSE; // -n
BOOL bDoShowProtoCons = FALSE; // -p