reactos/base/applications/network/net/cmdHelpMsg.c
Hermès Bélusca-Maïto 8a3822c4ea Sync with trunk r63647.
svn path=/branches/condrv_restructure/; revision=63648
2014-06-27 18:05:20 +00:00

64 lines
1.3 KiB
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS net command
* FILE: cmdHelpmsg.c
* PURPOSE:
*
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
*/
#include "net.h"
#include <stdlib.h>
INT cmdHelpMsg(INT argc, WCHAR **argv)
{
LPWSTR endptr;
LPWSTR lpBuffer;
LONG errNum;
INT i;
if (argc < 3)
{
PrintResourceString(IDS_HELPMSG_SYNTAX);
return 1;
}
for (i = 2; i < argc; i++)
{
if (_wcsicmp(argv[i], L"/help") == 0)
{
PrintResourceString(IDS_HELPMSG_HELP);
return 1;
}
}
errNum = wcstol(argv[2], &endptr, 10);
if (*endptr != 0)
{
PrintResourceString(IDS_HELPMSG_SYNTAX);
return 1;
}
/* Unicode printing is not supported in ReactOS yet */
if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
errNum,
LANG_USER_DEFAULT,
(LPWSTR)&lpBuffer,
0,
NULL))
{
printf("\n%S\n", lpBuffer);
LocalFree(lpBuffer);
}
else
{
printf("Unrecognized error code: %ld\n", errNum);
}
return 0;
}
/* EOF */