mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:32:59 +00:00
[NETSTAT] Fix output formats and more (#1709)
* [NETSTAT] Restore expected output formats
"Revert" parts of bd3c852012
.
CORE-16119
* [NETSTAT] Improve default and ICMPv4 output formats
* [NETSTAT] Fix a few typos, in output strings
* [NETSTAT] Output usage to StdErr
* [NETSTAT] Be more explicit about unimplemented -b/-t/-v options
This commit is contained in:
parent
5734570a15
commit
1fa2780796
2 changed files with 69 additions and 59 deletions
|
@ -3,10 +3,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_USAGE "\nDisplays current TCP/IP protocol statistics and network connections.\n\n\
|
||||
NETSTAT [-a] [-e] [-n] [-o] [-p proto] [-r] [-s] [interval]\n\n\
|
||||
NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-t] [-v] [interval]\n\n\
|
||||
-a Displays all connections and listening ports.\n\
|
||||
-b FIXME (Accepted option though unimplemented feature).\n\
|
||||
-e Displays Ethernet statistics. May be combined with -s\n\
|
||||
option\n\
|
||||
option.\n\
|
||||
-n Displays address and port numbers in numeric form.\n\
|
||||
-o Displays the process ID for each connection.\n\
|
||||
-p proto Shows connections for protocol 'proto' TCP or UDP.\n\
|
||||
|
@ -16,9 +17,11 @@ NETSTAT [-a] [-e] [-n] [-o] [-p proto] [-r] [-s] [interval]\n\n\
|
|||
-s Displays per-protocol statistics. By default, Statistics are\n\
|
||||
shown for IP, ICMP, TCP and UDP;\n\
|
||||
the -p option may be used to specify a subset of the default.\n\
|
||||
-t FIXME (Accepted option though unimplemented feature).\n\
|
||||
-v FIXME (Accepted option though unimplemented feature).\n\
|
||||
interval Redisplays selected statistics every 'interval' seconds.\n\
|
||||
Press CTRL+C to stop redisplaying. By default netstat will\n\
|
||||
print the current information only once.\n\n"
|
||||
print the current information only once.\n"
|
||||
IDS_DISPLAY_THEADER "\n Proto Local Address Foreign Address State"
|
||||
IDS_DISPLAY_PROCESS " Process\n"
|
||||
IDS_ACTIVE_CONNECT "\nActive Connections\n"
|
||||
|
@ -37,9 +40,9 @@ BEGIN
|
|||
IDS_IP_OUT_REQUEST " Output Requests = %lu\n"
|
||||
IDS_IP_ROUTE_DISCARD " Routing Discards = %lu\n"
|
||||
IDS_IP_DISCARD_OUT_PACK " Discarded Output Packets = %lu\n"
|
||||
IDS_IP_OUT_PACKET_NO_ROUTE " Output Packets No Route = %lu\n"
|
||||
IDS_IP_OUT_PACKET_NO_ROUTE " Output Packet No Route = %lu\n"
|
||||
IDS_IP_REASSEMBLE_REQUIRED " Reassembly Required = %lu\n"
|
||||
IDS_IP_REASSEMBLE_SUCCESS " Reassembly Succesful = %lu\n"
|
||||
IDS_IP_REASSEMBLE_SUCCESS " Reassembly Successful = %lu\n"
|
||||
IDS_IP_REASSEMBLE_FAILURE " Reassembly Failures = %lu\n"
|
||||
IDS_IP_DATAG_FRAG_SUCCESS " Datagrams Successfully Fragmented = %lu\n"
|
||||
IDS_IP_DATAG_FRAG_FAILURE " Datagrams Failing Fragmentation = %lu\n"
|
||||
|
@ -50,19 +53,19 @@ STRINGTABLE
|
|||
BEGIN
|
||||
IDS_ICMP4_STAT_HEADER "\nICMPv4 Statistics\n\n"
|
||||
IDS_ICMP_THEADER " Received Sent\n"
|
||||
IDS_ICMP_MSG " Messages %-11lu %lu\n"
|
||||
IDS_ICMP_ERROR " Errors %-11lu %lu\n"
|
||||
IDS_ICMP_DEST_UNREACH " Destination Unreachable %-11lu %lu\n"
|
||||
IDS_ICMP_TIME_EXCEED " Time Exceeded %-11lu %lu\n"
|
||||
IDS_ICMP_PARAM_PROBLEM " Parameter Problems %-11lu %lu\n"
|
||||
IDS_ICMP_SRC_QUENCHES " Source Quenches %-11lu %lu\n"
|
||||
IDS_ICMP_REDIRECT " Redirects %-11lu %lu\n"
|
||||
IDS_ICMP_ECHO " Echos %-11lu %lu\n"
|
||||
IDS_ICMP_ECHO_REPLY " Echo Replies %-11lu %lu\n"
|
||||
IDS_ICMP_TIMESTAMP " Timestamps %-11lu %lu\n"
|
||||
IDS_ICMP_TIMESTAMP_REPLY " Timestamp Replies %-11lu %lu\n"
|
||||
IDS_ICMP_ADDRESSS_MASK " Address Masks %-11lu %lu\n"
|
||||
IDS_ICMP_ADDRESSS_MASK_REPLY " Address Mask Replies %-11lu %lu\n"
|
||||
IDS_ICMP_MSG " Messages %-11lu %-10lu\n"
|
||||
IDS_ICMP_ERROR " Errors %-11lu %-10lu\n"
|
||||
IDS_ICMP_DEST_UNREACH " Destination Unreachable %-11lu %-10lu\n"
|
||||
IDS_ICMP_TIME_EXCEED " Time Exceeded %-11lu %-10lu\n"
|
||||
IDS_ICMP_PARAM_PROBLEM " Parameter Problems %-11lu %-10lu\n"
|
||||
IDS_ICMP_SRC_QUENCHES " Source Quenches %-11lu %-10lu\n"
|
||||
IDS_ICMP_REDIRECT " Redirects %-11lu %-10lu\n"
|
||||
IDS_ICMP_ECHO " Echos %-11lu %-10lu\n"
|
||||
IDS_ICMP_ECHO_REPLY " Echo Replies %-11lu %-10lu\n"
|
||||
IDS_ICMP_TIMESTAMP " Timestamps %-11lu %-10lu\n"
|
||||
IDS_ICMP_TIMESTAMP_REPLY " Timestamp Replies %-11lu %-10lu\n"
|
||||
IDS_ICMP_ADDRESSS_MASK " Address Masks %-11lu %-10lu\n"
|
||||
IDS_ICMP_ADDRESSS_MASK_REPLY " Address Mask Replies %-11lu %-10lu\n"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
@ -96,7 +99,7 @@ BEGIN
|
|||
IDS_ETHERNET_NON_UNICAST_PACKET "Non-unicast packets %14lu %15lu\n"
|
||||
IDS_ETHERNET_DISCARD "Discards %14lu %15lu\n"
|
||||
IDS_ETHERNET_ERROR "Errors %14lu %15lu\n"
|
||||
IDS_ETHERNET_UNKNOWN " Unknown Protocols %14lu\n"
|
||||
IDS_ETHERNET_UNKNOWN "Unknown protocols %14lu\n"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/*
|
||||
* TODO:
|
||||
* sort function return values.
|
||||
* implement -b, -o and -v
|
||||
* implement -b, -t and -v
|
||||
* clean up GetIpHostName
|
||||
* command line parser needs more work
|
||||
*/
|
||||
|
@ -88,6 +88,8 @@ BOOL ParseCmdline(int argc, wchar_t* argv[])
|
|||
bDoShowAllCons = TRUE;
|
||||
break;
|
||||
case L'b':
|
||||
// UNIMPLEMENTED.
|
||||
ConPuts(StdErr, L"'b' option is FIXME (Accepted option though unimplemented feature).\n");
|
||||
bDoShowProcName = TRUE;
|
||||
break;
|
||||
case L'e':
|
||||
|
@ -96,6 +98,9 @@ BOOL ParseCmdline(int argc, wchar_t* argv[])
|
|||
case L'n':
|
||||
bDoShowNumbers = TRUE;
|
||||
break;
|
||||
case L'o':
|
||||
bDoShowProcessId = TRUE;
|
||||
break;
|
||||
case L'p':
|
||||
bDoShowProtoCons = TRUE;
|
||||
Proto = argv[i+1];
|
||||
|
@ -109,7 +114,7 @@ BOOL ParseCmdline(int argc, wchar_t* argv[])
|
|||
Protocol = UDP;
|
||||
else
|
||||
{
|
||||
ConResPuts(StdOut, IDS_USAGE);
|
||||
ConResPuts(StdErr, IDS_USAGE);
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -119,16 +124,17 @@ BOOL ParseCmdline(int argc, wchar_t* argv[])
|
|||
case L's':
|
||||
bDoShowProtoStats = TRUE;
|
||||
break;
|
||||
case L'o':
|
||||
bDoShowProcessId = TRUE;
|
||||
case L't':
|
||||
// UNIMPLEMENTED.
|
||||
ConPuts(StdErr, L"'t' option is FIXME (Accepted option though unimplemented feature).\n");
|
||||
break;
|
||||
case L'v':
|
||||
// FIXME!
|
||||
ConPuts(StdOut, L"got v\n");
|
||||
// UNIMPLEMENTED.
|
||||
ConPuts(StdErr, L"'v' option is FIXME (Accepted option though unimplemented feature).\n");
|
||||
bDoDispSeqComp = TRUE;
|
||||
break;
|
||||
default :
|
||||
ConResPuts(StdOut, IDS_USAGE);
|
||||
ConResPuts(StdErr, IDS_USAGE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +148,7 @@ BOOL ParseCmdline(int argc, wchar_t* argv[])
|
|||
}
|
||||
// else
|
||||
// {
|
||||
// ConResPrintf(StdOut, IDS_USAGE);
|
||||
// ConResPrintf(StdErr, IDS_USAGE);
|
||||
// return FALSE;
|
||||
// }
|
||||
}
|
||||
|
@ -169,6 +175,7 @@ BOOL DisplayOutput(VOID)
|
|||
{
|
||||
if (bNoOptions)
|
||||
{
|
||||
ConResPuts(StdOut, IDS_ACTIVE_CONNECT);
|
||||
DisplayTableHeader();
|
||||
return ShowTcpTable();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue