reactos/base/shell/cmd/ver.c
Amine Khaldi 527f2f9057 [SHELL/EXPERIMENTS]
* Create a branch for some evul shell experiments.

svn path=/branches/shell-experiments/; revision=61927
2014-02-02 19:37:27 +00:00

124 lines
3.3 KiB
C

/*
* VER.C - ver internal command.
*
*
* History:
*
* 06/30/98 (Rob Lake)
* rewrote ver command to accept switches, now ver alone prints
* copyright notice only.
*
* 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added config.h include
*
* 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
* added text about where to send bug reports and get updates.
*
* 20-Jan-1999 (Eric Kohl)
* Unicode and redirection safe!
*
* 26-Feb-1999 (Eric Kohl)
* New version info and some output changes.
*/
#include "precomp.h"
#include <reactos/buildno.h>
#include <reactos/version.h>
VOID ShortVersion (VOID)
{
OSVERSIONINFO VersionInfo;
ConOutResPrintf(STRING_CMD_SHELLINFO, _T(KERNEL_RELEASE_STR), _T(KERNEL_VERSION_BUILD_STR));
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
memset(VersionInfo.szCSDVersion, 0, sizeof(VersionInfo.szCSDVersion));
if (GetVersionEx(&VersionInfo))
{
LPTSTR RosVersion;
SIZE_T RosVersionLen;
RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1;
RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) -
(RosVersion - VersionInfo.szCSDVersion);
if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7))
{
ConOutResPrintf(STRING_VERSION_RUNVER, RosVersion);
}
}
ConOutChar(_T('\n'));
}
#ifdef INCLUDE_CMD_VER
/*
* display shell version info internal command.
*/
INT cmd_ver (LPTSTR param)
{
INT i;
nErrorLevel = 0;
if (_tcsstr (param, _T("/?")) != NULL)
{
ConOutResPaging(TRUE,STRING_VERSION_HELP1);
return 0;
}
ShortVersion();
/* Basic copyright notice */
if (param[0] != _T('\0'))
{
ConOutPuts(_T("Copyright (C) 1994-1998 Tim Norman and others.\n"));
ConOutPuts(_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team\n"));
for (i = 0; param[i]; i++)
{
/* skip spaces */
if (param[i] == _T(' '))
continue;
if (param[i] == _T('/'))
{
/* is this a lone '/' ? */
if (param[i + 1] == 0)
{
error_invalid_switch (_T(' '));
return 1;
}
continue;
}
if (_totupper (param[i]) == _T('W'))
{
/* Warranty notice */
ConOutResPuts(STRING_VERSION_HELP3);
}
else if (_totupper (param[i]) == _T('R'))
{
/* Redistribution notice */
ConOutResPuts(STRING_VERSION_HELP4);
}
else if (_totupper (param[i]) == _T('C'))
{
/* Developer listing */
ConOutResPuts(STRING_VERSION_HELP6);
ConOutResPuts(STRING_FREEDOS_DEV);
ConOutResPuts(STRING_VERSION_HELP7);
ConOutResPuts(STRING_REACTOS_DEV);
}
else
{
error_invalid_switch ((TCHAR)_totupper (param[i]));
return 1;
}
}
ConOutResPuts(STRING_VERSION_HELP5);
}
return 0;
}
#endif