[NET]
[reactos.git] / reactos / base / applications / network / net / cmdHelpMsg.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: base/applications/network/net/cmdHelpMsg.c
5 * PURPOSE:
6 *
7 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8 */
9
10 #include "net.h"
11
12 #include <stdlib.h>
13
14 INT cmdHelpMsg(INT argc, WCHAR **argv)
15 {
16 LPWSTR endptr;
17 LPWSTR lpBuffer;
18 LONG errNum;
19 INT i;
20
21 if (argc < 3)
22 {
23 PrintResourceString(IDS_HELPMSG_SYNTAX);
24 return 1;
25 }
26
27 for (i = 2; i < argc; i++)
28 {
29 if (_wcsicmp(argv[i], L"/help") == 0)
30 {
31 PrintResourceString(IDS_HELPMSG_HELP);
32 return 1;
33 }
34 }
35
36 errNum = wcstol(argv[2], &endptr, 10);
37 if (*endptr != 0)
38 {
39 PrintResourceString(IDS_HELPMSG_SYNTAX);
40 return 1;
41 }
42
43 /* Unicode printing is not supported in ReactOS yet */
44 if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
45 NULL,
46 errNum,
47 LANG_USER_DEFAULT,
48 (LPWSTR)&lpBuffer,
49 0,
50 NULL))
51 {
52 PrintToConsole(L"\n%s\n", lpBuffer);
53 LocalFree(lpBuffer);
54 }
55 else
56 {
57 PrintToConsole(L"Unrecognized error code: %ld\n", errNum);
58 }
59
60 return 0;
61 }
62
63 /* EOF */
64