* Sync up to trunk head (r64829).
[reactos.git] / base / applications / network / net / main.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE:
5 * PURPOSE:
6 *
7 * PROGRAMMERS: Magnus Olsen (greatlord@reactos.org)
8 */
9
10 #include "net.h"
11
12 #define MAX_BUFFER_SIZE 4096
13
14 typedef struct _COMMAND
15 {
16 WCHAR *name;
17 INT (*func)(INT, WCHAR**);
18 // VOID (*help)(INT, WCHAR**);
19 } COMMAND, *PCOMMAND;
20
21 COMMAND cmds[] =
22 {
23 {L"accounts", cmdAccounts},
24 {L"computer", unimplemented},
25 {L"config", unimplemented},
26 {L"continue", cmdContinue},
27 {L"file", unimplemented},
28 {L"group", unimplemented},
29 {L"help", cmdHelp},
30 {L"helpmsg", cmdHelpMsg},
31 {L"localgroup", unimplemented},
32 {L"name", unimplemented},
33 {L"pause", cmdPause},
34 {L"print", unimplemented},
35 {L"send", unimplemented},
36 {L"session", unimplemented},
37 {L"share", unimplemented},
38 {L"start", cmdStart},
39 {L"statistics", unimplemented},
40 {L"stop", cmdStop},
41 {L"time", unimplemented},
42 {L"use", unimplemented},
43 {L"user", unimplemented},
44 {L"view", unimplemented},
45 {NULL, NULL}
46 };
47
48
49 VOID
50 PrintResourceString(
51 INT resID,
52 ...)
53 {
54 WCHAR szMsgBuf[MAX_BUFFER_SIZE];
55 va_list arg_ptr;
56
57 va_start(arg_ptr, resID);
58 LoadStringW(GetModuleHandle(NULL), resID, szMsgBuf, MAX_BUFFER_SIZE);
59 vwprintf(szMsgBuf, arg_ptr);
60 va_end(arg_ptr);
61 }
62
63
64 int wmain(int argc, WCHAR **argv)
65 {
66 PCOMMAND cmdptr;
67
68 if (argc < 2)
69 {
70 PrintResourceString(IDS_NET_SYNTAX);
71 return 1;
72 }
73
74 /* Scan the command table */
75 for (cmdptr = cmds; cmdptr->name; cmdptr++)
76 {
77 if (_wcsicmp(argv[1], cmdptr->name) == 0)
78 {
79 return cmdptr->func(argc, argv);
80 }
81 }
82
83 PrintResourceString(IDS_NET_SYNTAX);
84
85 return 1;
86 }
87
88 INT unimplemented(INT argc, WCHAR **argv)
89 {
90 puts("This command is not implemented yet");
91 return 1;
92 }