mirror of
https://github.com/reactos/reactos
synced 2025-10-06 00:12:51 +02:00
[NETSH] Simplify the code by naming the root context 'netsh'
-
This commit is contained in:
@@ -436,7 +436,7 @@ CreateRootContext(VOID)
|
|||||||
{
|
{
|
||||||
PCOMMAND_GROUP pGroup;
|
PCOMMAND_GROUP pGroup;
|
||||||
|
|
||||||
pRootContext = AddContext(NULL, NULL, NULL);
|
pRootContext = AddContext(NULL, L"netsh", NULL);
|
||||||
DPRINT("pRootContext: %p\n", pRootContext);
|
DPRINT("pRootContext: %p\n", pRootContext);
|
||||||
if (pRootContext == NULL)
|
if (pRootContext == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -21,7 +21,7 @@ GetContextFullName(
|
|||||||
_Inout_ LPWSTR pszBuffer,
|
_Inout_ LPWSTR pszBuffer,
|
||||||
_In_ DWORD cchLength)
|
_In_ DWORD cchLength)
|
||||||
{
|
{
|
||||||
if (pContext->pParentContext != NULL)
|
if (pContext != pRootContext)
|
||||||
{
|
{
|
||||||
GetContextFullName(pContext->pParentContext, pszBuffer, cchLength);
|
GetContextFullName(pContext->pParentContext, pszBuffer, cchLength);
|
||||||
wcscat(pszBuffer, L" ");
|
wcscat(pszBuffer, L" ");
|
||||||
@@ -29,7 +29,7 @@ GetContextFullName(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcscpy(pszBuffer, L"netsh");
|
wcscpy(pszBuffer, pContext->pszContextName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,16 +43,12 @@ PrintCurrentContextHeader(
|
|||||||
|
|
||||||
if (pContext == pCurrentContext)
|
if (pContext == pCurrentContext)
|
||||||
{
|
{
|
||||||
ConPrintf(StdOut, L"\nCommands in this context:\n");
|
ConResPrintf(StdOut, IDS_THIS_COMMANDS);
|
||||||
}
|
|
||||||
else if (pContext == pRootContext)
|
|
||||||
{
|
|
||||||
ConPrintf(StdOut, L"\nCommands in the netsh-context:\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetContextFullName(pContext, szBuffer, 80);
|
GetContextFullName(pContext, szBuffer, 80);
|
||||||
ConPrintf(StdOut, L"\nCommands in the %s-context:\n", szBuffer);
|
ConResPrintf(StdOut, IDS_CONTEXT_COMMANDS, szBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -224,16 +224,13 @@ VOID
|
|||||||
PrintPrompt(
|
PrintPrompt(
|
||||||
PCONTEXT_ENTRY pContext)
|
PCONTEXT_ENTRY pContext)
|
||||||
{
|
{
|
||||||
if (pContext == pRootContext)
|
if (pContext != pRootContext)
|
||||||
{
|
|
||||||
ConPuts(StdOut, L"netsh");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
PrintPrompt(pContext->pParentContext);
|
PrintPrompt(pContext->pParentContext);
|
||||||
ConPuts(StdOut, L" ");
|
ConPuts(StdOut, L" ");
|
||||||
ConPuts(StdOut, pContext->pszContextName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConPuts(StdOut, pContext->pszContextName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,9 +12,11 @@ STRINGTABLE
|
|||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_USAGE "\nUsage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] \
|
IDS_APP_USAGE "\nUsage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] \
|
||||||
\n [Command | -f ScriptFile]\n"
|
\n [Command | -f ScriptFile]\n"
|
||||||
IDS_INVALID_COMMAND "The following command was not found: %ls.\n"
|
IDS_INVALID_COMMAND "The following command was not found: %ls.\n"
|
||||||
IDS_OPEN_FAILED "The file %ls could not be openend.\n"
|
IDS_OPEN_FAILED "The file %ls could not be openend.\n"
|
||||||
IDS_INVALID_SYNTAX "The syntax supplied for this command is not valid. Check help for the correct syntax.\n\n"
|
IDS_INVALID_SYNTAX "The syntax supplied for this command is not valid. Check help for the correct syntax.\n\n"
|
||||||
|
IDS_THIS_COMMANDS "\nCommands in this context:\n"
|
||||||
|
IDS_CONTEXT_COMMANDS "\nCommands in the %s-context:\n"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE
|
STRINGTABLE
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
#define IDS_INVALID_COMMAND 102
|
#define IDS_INVALID_COMMAND 102
|
||||||
#define IDS_OPEN_FAILED 103
|
#define IDS_OPEN_FAILED 103
|
||||||
#define IDS_INVALID_SYNTAX 104
|
#define IDS_INVALID_SYNTAX 104
|
||||||
|
#define IDS_THIS_COMMANDS 105
|
||||||
|
#define IDS_CONTEXT_COMMANDS 106
|
||||||
|
|
||||||
#define IDS_HELP_HEADER 200
|
#define IDS_HELP_HEADER 200
|
||||||
#define IDS_HELP_FOOTER 201
|
#define IDS_HELP_FOOTER 201
|
||||||
|
Reference in New Issue
Block a user