-
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS net command
#include "net.h"
+#define MAX_BUFFER_SIZE 4096
+typedef struct _COMMAND
+{
+ WCHAR *name;
+ INT (*func)(INT, WCHAR**);
+// VOID (*help)(INT, WCHAR**);
+} COMMAND, *PCOMMAND;
-int main(int argc, char **argv)
+COMMAND cmds[] =
+{
+ {L"accounts", cmdAccounts},
+ {L"computer", unimplemented},
+ {L"config", unimplemented},
+ {L"continue", cmdContinue},
+ {L"file", unimplemented},
+ {L"group", unimplemented},
+ {L"help", cmdHelp},
+ {L"helpmsg", cmdHelpMsg},
+ {L"localgroup", cmdLocalGroup},
+ {L"name", unimplemented},
+ {L"pause", cmdPause},
+ {L"print", unimplemented},
+ {L"send", unimplemented},
+ {L"session", unimplemented},
+ {L"share", unimplemented},
+ {L"start", cmdStart},
+ {L"statistics", unimplemented},
+ {L"stop", cmdStop},
+ {L"time", unimplemented},
+ {L"use", unimplemented},
+ {L"user", unimplemented},
+ {L"view", unimplemented},
+ {NULL, NULL}
+};
+
+
+VOID
+PrintResourceString(
+ INT resID,
+ ...)
{
- if (argc<2)
- {
- help();
- return 1;
- }
+ WCHAR szMsgBuf[MAX_BUFFER_SIZE];
+ va_list arg_ptr;
- if (_stricmp(argv[1],"ACCOUNTS")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"COMPUTER")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"CONFIG")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"CONTINUE")==0)
- {
- return unimplemented();
- }
+ va_start(arg_ptr, resID);
+ LoadStringW(GetModuleHandle(NULL), resID, szMsgBuf, MAX_BUFFER_SIZE);
+ vwprintf(szMsgBuf, arg_ptr);
+ va_end(arg_ptr);
+}
- if (_stricmp(argv[1],"FILE")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"GROUP")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"HELP")==0)
- {
- return cmdHelp(argc,&argv[1]);
- }
- if (_stricmp(argv[1],"HELPMSG")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"LOCALGROUP")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"NAME")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"PRINT")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"SEND")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"SESSION")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"SHARE")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"START")==0)
- {
- return cmdStart(argc, &argv[1]);
- }
- if (_stricmp(argv[1],"STATISTICS")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"STOP")==0)
- {
- return cmdStop(argc, &argv[1]);
- }
- if (_stricmp(argv[1],"TIME")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"USE")==0)
- {
- return unimplemented();
- }
- if (_stricmp(argv[1],"USER")==0)
+int wmain(int argc, WCHAR **argv)
+{
+ PCOMMAND cmdptr;
+
+ if (argc < 2)
{
- return unimplemented();
+ PrintResourceString(IDS_NET_SYNTAX);
+ return 1;
}
- if (_stricmp(argv[1],"VIEW")==0)
+
+ /* Scan the command table */
+ for (cmdptr = cmds; cmdptr->name; cmdptr++)
{
- return unimplemented();
+ if (_wcsicmp(argv[1], cmdptr->name) == 0)
+ {
+ return cmdptr->func(argc, argv);
+ }
}
- help();
- return 1;
-}
+ PrintResourceString(IDS_NET_SYNTAX);
+ return 1;
+}
-int unimplemented()
+INT unimplemented(INT argc, WCHAR **argv)
{
- puts("This command is not implemented yet");
- return 1;
+ puts("This command is not implemented yet");
+ return 1;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-