[NET] Add (incomplete) COMPUTER command and rename help.c to cmdHelp.c.

This commit is contained in:
Eric Kohl 2018-12-24 14:39:26 +01:00
parent c4118adf80
commit 7a27dc8a55
5 changed files with 107 additions and 2 deletions

View file

@ -6,6 +6,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)
list(APPEND SOURCE
main.c
cmdAccounts.c
cmdComputer.c
cmdConfig.c
cmdContinue.c
cmdGroup.c

View file

@ -0,0 +1,103 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS net command
* FILE: base/applications/network/net/cmdComputer.c
* PROGRAMMERS: Eric Kohl <eric.kohl@reactos.org>
*/
#include "net.h"
INT
cmdComputer(
INT argc,
WCHAR **argv)
{
INT i, result = 0;
BOOL bAdd = FALSE;
BOOL bDelete = FALSE;
PWSTR pComputerName = NULL;
/*
OSVERSIONINFOEX VersionInfo;
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
if (!GetVersionEx((LPOSVERSIONINFO)&VersionInfo))
{
PrintErrorMessage(GetLastError());
return 1;
}
if (VersionInfo.wProductType != VER_NT_DOMAIN_CONTROLLER)
{
PrintErrorMessage(3515);
return 1;
}
*/
i = 2;
if (argc > 2 && argv[i][0] != L'\\' && argv[i][1] != L'\\')
{
pComputerName = argv[i];
i++;
}
for (; i < argc; i++)
{
if (_wcsicmp(argv[i], L"help") == 0)
{
/* Print short syntax help */
ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
PrintNetMessage(MSG_COMPUTER_SYNTAX);
return 0;
}
if (_wcsicmp(argv[i], L"/help") == 0)
{
/* Print full help text*/
ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
PrintNetMessage(MSG_COMPUTER_SYNTAX);
PrintNetMessage(MSG_COMPUTER_HELP);
return 0;
}
if (_wcsicmp(argv[i], L"/add") == 0)
{
bAdd = TRUE;
continue;
}
else if (_wcsicmp(argv[i], L"/del") == 0)
{
bDelete = TRUE;
continue;
}
else
{
PrintErrorMessage(3506/*, argv[i]*/);
return 1;
}
}
if (pComputerName == NULL ||
(bAdd == FALSE && bDelete == FALSE) ||
(bAdd == TRUE && bDelete == TRUE))
{
ConResPuts(StdOut, IDS_GENERIC_SYNTAX);
PrintNetMessage(MSG_COMPUTER_SYNTAX);
return 1;
}
if (bAdd)
{
printf("Add %S (not implemented yet)\n", pComputerName);
}
else if (bDelete)
{
printf("Delete %S (not implemented yet)\n", pComputerName);
}
if (result == 0)
PrintErrorMessage(ERROR_SUCCESS);
return result;
}
/* EOF */

View file

@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS net command
* FILE: base/applications/network/net/help.c
* FILE: base/applications/network/net/cmdHelp.c
* PURPOSE:
*
* PROGRAMMERS: Magnus Olsen (greatlord@reactos.org)

View file

@ -21,7 +21,7 @@ typedef struct _COMMAND
COMMAND cmds[] =
{
{L"accounts", cmdAccounts},
{L"computer", unimplemented},
{L"computer", cmdComputer},
{L"config", cmdConfig},
{L"continue", cmdContinue},
{L"file", unimplemented},

View file

@ -57,6 +57,7 @@ VOID help(VOID);
INT unimplemented(INT argc, WCHAR **argv);
INT cmdAccounts(INT argc, WCHAR **argv);
INT cmdComputer(INT argc, WCHAR **argv);
INT cmdConfig(INT argc, WCHAR **argv);
INT cmdContinue(INT argc, WCHAR **argv);
INT cmdGroup(INT argc, WCHAR **argv);