mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[ROUTE] Make ROUTE translatable
- English text only
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
|
||||
|
||||
add_executable(route route.c route.rc)
|
||||
set_module_type(route win32cui UNICODE)
|
||||
target_link_libraries(route conutils ${PSEH_LIB})
|
||||
add_importlibs(route ws2_32 iphlpapi msvcrt kernel32)
|
||||
add_cd_file(TARGET route DESTINATION reactos/system32 FOR all)
|
||||
|
||||
49
base/applications/network/route/lang/en-US.rc
Normal file
49
base/applications/network/route/lang/en-US.rc
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* FILE: base/applications/network/route/lang/en-US.rc
|
||||
* PURPOSE: English translations for ReactOS Route Command
|
||||
* TRANSLATORS:
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_USAGE "\n\
|
||||
route usage:\n\
|
||||
route print\n\
|
||||
prints the route table\n\
|
||||
route add <target> [mask <mask>] <gw> [metric <m>]\n\
|
||||
adds a route\n\
|
||||
route delete <target> <gw>\n\
|
||||
deletes a route\n"
|
||||
|
||||
IDS_ROUTE_ADD_HELP "\n\
|
||||
route add usage:\n\
|
||||
route add <target> [mask <mask>] <gw> [metric <m>]\n\
|
||||
Adds a route to the IP route table.\n\
|
||||
<target> is the network or host to add a route to.\n\
|
||||
<mask> is the netmask to use (autodetected if unspecified)\n\
|
||||
<gw> is the gateway to use to access the network\n\
|
||||
<m> is the metric to use (lower is preferred)\n"
|
||||
|
||||
IDS_ROUTE_DEL_HELP "\n\
|
||||
route delete usage:\n\
|
||||
route delete <target> <gw>\n\
|
||||
Removes a route from the IP route table.\n\
|
||||
<target> is the network or host to add a route to.\n\
|
||||
<gw> is the gateway to remove the route from.\n"
|
||||
|
||||
IDS_ROUTE_ADD_ERROR "Route addition failed\n"
|
||||
IDS_ROUTE_DEL_ERROR "Route deletion failed\n"
|
||||
IDS_ROUTE_ENUM_ERROR "Route enumeration failed\n"
|
||||
IDS_SEPARATOR "===========================================================================\n"
|
||||
IDS_INTERFACE_LIST "Interface List\n"
|
||||
IDS_INTERFACE_ENTRY "0x%lu ........................... %hs\n"
|
||||
IDS_IPV4_ROUTE_TABLE "\nIPv4 Route Table\n"
|
||||
IDS_ACTIVE_ROUTES "Active Routes:\n"
|
||||
IDS_ROUTES_ENTRY "%17s%17s%17s%16ld%9ld\n"
|
||||
IDS_PERSISTENT_ROUTES "Persistent Routes:\n"
|
||||
IDS_DEFAULT_GATEWAY "Default Gateway:%18s\n"
|
||||
IDS_ROUTES_HEADER "Network Destination Netmask Gateway Interface Metric\n"
|
||||
IDS_NONE " None\n"
|
||||
END
|
||||
18
base/applications/network/route/resource.h
Normal file
18
base/applications/network/route/resource.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#define IDS_USAGE 100
|
||||
#define IDS_ROUTE_ADD_HELP 101
|
||||
#define IDS_ROUTE_DEL_HELP 102
|
||||
#define IDS_ROUTE_ADD_ERROR 103
|
||||
#define IDS_ROUTE_DEL_ERROR 104
|
||||
#define IDS_ROUTE_ENUM_ERROR 105
|
||||
#define IDS_SEPARATOR 106
|
||||
#define IDS_INTERFACE_LIST 107
|
||||
#define IDS_INTERFACE_ENTRY 108
|
||||
#define IDS_IPV4_ROUTE_TABLE 109
|
||||
#define IDS_ACTIVE_ROUTES 110
|
||||
#define IDS_PERSISTENT_ROUTES 111
|
||||
#define IDS_ROUTES_ENTRY 112
|
||||
#define IDS_DEFAULT_GATEWAY 113
|
||||
#define IDS_ROUTES_HEADER 114
|
||||
#define IDS_NONE 120
|
||||
@@ -21,20 +21,16 @@
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <tchar.h>
|
||||
#include <conutils.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define IPBUF 17
|
||||
#define IN_ADDR_OF(x) *((struct in_addr *)&(x))
|
||||
|
||||
static int Usage()
|
||||
{
|
||||
_ftprintf( stderr,
|
||||
_T("route usage:\n")
|
||||
_T("route print\n")
|
||||
_T(" prints the route table\n")
|
||||
_T("route add <target> [mask <mask>] <gw> [metric <m>]\n")
|
||||
_T(" adds a route\n")
|
||||
_T("route delete <target> <gw>\n")
|
||||
_T(" deletes a route\n") );
|
||||
ConResPrintf(StdErr, IDS_USAGE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -45,7 +41,7 @@ static int PrintRoutes()
|
||||
ULONG Size = 0;
|
||||
DWORD Error = 0;
|
||||
ULONG adaptOutBufLen = sizeof(IP_ADAPTER_INFO);
|
||||
TCHAR DefGate[16];
|
||||
WCHAR DefGate[16];
|
||||
TCHAR Destination[IPBUF], Gateway[IPBUF], Netmask[IPBUF];
|
||||
unsigned int i;
|
||||
|
||||
@@ -86,29 +82,20 @@ static int PrintRoutes()
|
||||
_T("%s"),
|
||||
#endif
|
||||
pAdapterInfo->GatewayList.IpAddress.String);
|
||||
_tprintf(_T("===========================================================================\n"));
|
||||
_tprintf(_T("Interface List\n"));
|
||||
ConResPrintf(StdOut, IDS_SEPARATOR);
|
||||
ConResPrintf(StdOut, IDS_INTERFACE_LIST);
|
||||
/* FIXME - sort by the index! */
|
||||
while (pAdapterInfo)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
_tprintf(_T("0x%lu ........................... %hs\n"),
|
||||
#else
|
||||
_tprintf(_T("0x%lu ........................... %s\n"),
|
||||
#endif
|
||||
pAdapterInfo->Index, pAdapterInfo->Description);
|
||||
ConResPrintf(StdOut, IDS_INTERFACE_ENTRY, pAdapterInfo->Index, pAdapterInfo->Description);
|
||||
pAdapterInfo = pAdapterInfo->Next;
|
||||
}
|
||||
_tprintf(_T("===========================================================================\n"));
|
||||
ConResPrintf(StdOut, IDS_SEPARATOR);
|
||||
|
||||
_tprintf(_T("===========================================================================\n"));
|
||||
_tprintf(_T("Active Routes:\n"));
|
||||
_tprintf( _T("%-27s%-17s%-14s%-11s%-10s\n"),
|
||||
_T("Network Destination"),
|
||||
_T("Netmask"),
|
||||
_T("Gateway"),
|
||||
_T("Interface"),
|
||||
_T("Metric") );
|
||||
ConResPrintf(StdOut, IDS_IPV4_ROUTE_TABLE);
|
||||
ConResPrintf(StdOut, IDS_SEPARATOR);
|
||||
ConResPrintf(StdOut, IDS_ACTIVE_ROUTES);
|
||||
ConResPrintf(StdOut, IDS_ROUTES_HEADER);
|
||||
for( i = 0; i < IpForwardTable->dwNumEntries; i++ )
|
||||
{
|
||||
_stprintf( Destination,
|
||||
@@ -133,16 +120,18 @@ static int PrintRoutes()
|
||||
#endif
|
||||
inet_ntoa( IN_ADDR_OF(IpForwardTable->table[i].dwForwardNextHop) ) );
|
||||
|
||||
_tprintf( _T("%17s%17s%17s%16ld%9ld\n"),
|
||||
Destination,
|
||||
Netmask,
|
||||
Gateway,
|
||||
IpForwardTable->table[i].dwForwardIfIndex,
|
||||
IpForwardTable->table[i].dwForwardMetric1 );
|
||||
ConResPrintf(StdOut, IDS_ROUTES_ENTRY,
|
||||
Destination,
|
||||
Netmask,
|
||||
Gateway,
|
||||
IpForwardTable->table[i].dwForwardIfIndex,
|
||||
IpForwardTable->table[i].dwForwardMetric1);
|
||||
}
|
||||
_tprintf(_T("Default Gateway:%18s\n"), DefGate);
|
||||
_tprintf(_T("===========================================================================\n"));
|
||||
_tprintf(_T("Persistent Routes:\n"));
|
||||
ConResPrintf(StdOut, IDS_DEFAULT_GATEWAY, DefGate);
|
||||
ConResPrintf(StdOut, IDS_SEPARATOR);
|
||||
|
||||
ConResPrintf(StdOut, IDS_PERSISTENT_ROUTES);
|
||||
ConResPrintf(StdOut, IDS_NONE);
|
||||
|
||||
free(IpForwardTable);
|
||||
free(pAdapterInfo);
|
||||
@@ -154,7 +143,7 @@ static int PrintRoutes()
|
||||
Error:
|
||||
if (pAdapterInfo) free(pAdapterInfo);
|
||||
if (IpForwardTable) free(IpForwardTable);
|
||||
_ftprintf( stderr, _T("Route enumerate failed\n") );
|
||||
ConResPrintf(StdErr, IDS_ROUTE_ENUM_ERROR);
|
||||
return Error;
|
||||
}
|
||||
}
|
||||
@@ -216,21 +205,14 @@ static int add_route( int argc, TCHAR **argv ) {
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) )
|
||||
{
|
||||
_ftprintf( stderr,
|
||||
_T("route add usage:\n")
|
||||
_T("route add <target> [mask <mask>] <gw> [metric <m>]\n")
|
||||
_T(" Adds a route to the IP route table.\n")
|
||||
_T(" <target> is the network or host to add a route to.\n")
|
||||
_T(" <mask> is the netmask to use (autodetected if unspecified)\n")
|
||||
_T(" <gw> is the gateway to use to access the network\n")
|
||||
_T(" <m> is the metric to use (lower is preferred)\n") );
|
||||
ConResPrintf(StdErr, IDS_ROUTE_ADD_HELP);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = CreateIpForwardEntry( &RowToAdd )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
_ftprintf( stderr, _T("Route addition failed\n") );
|
||||
ConResPrintf(StdErr, IDS_ROUTE_ADD_ERROR);
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -241,24 +223,22 @@ static int del_route( int argc, TCHAR **argv )
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) )
|
||||
{
|
||||
_ftprintf( stderr,
|
||||
_T("route delete usage:\n")
|
||||
_T("route delete <target> <gw>\n")
|
||||
_T(" Removes a route from the IP route table.\n")
|
||||
_T(" <target> is the network or host to add a route to.\n")
|
||||
_T(" <gw> is the gateway to remove the route from.\n") );
|
||||
ConResPrintf(StdErr, IDS_ROUTE_ADD_HELP);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = DeleteIpForwardEntry( &RowToDel )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
_ftprintf( stderr, _T("Route addition failed\n") );
|
||||
ConResPrintf(StdErr, IDS_ROUTE_DEL_ERROR);
|
||||
return Error;
|
||||
}
|
||||
|
||||
int _tmain( int argc, TCHAR **argv )
|
||||
{
|
||||
/* Initialize the Console Standard Streams */
|
||||
ConInitStdStreams();
|
||||
|
||||
if( argc < 2 )
|
||||
return Usage();
|
||||
else if ( !_tcscmp( argv[1], _T("print") ) )
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
#include <windef.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 Route"
|
||||
#define REACTOS_STR_INTERNAL_NAME "route"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "route.exe"
|
||||
#define REACTOS_STR_ORIGINAL_COPYRIGHT "Art Yerkes (arty@users.sourceforge.net)"
|
||||
#include <reactos/version.rc>
|
||||
|
||||
/* UTF-8 */
|
||||
#pragma code_page(65001)
|
||||
|
||||
#ifdef LANGUAGE_EN_US
|
||||
#include "lang/en-US.rc"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user