1 /* 2 * VER.C - ver internal command. 3 * 4 * 5 * History: 6 * 7 * 06/30/98 (Rob Lake) 8 * rewrote ver command to accept switches, now ver alone prints 9 * copyright notice only. 10 * 11 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>) 12 * added config.h include 13 * 14 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>) 15 * added text about where to send bug reports and get updates. 16 * 17 * 20-Jan-1999 (Eric Kohl) 18 * Unicode and redirection safe! 19 * 20 * 26-Feb-1999 (Eric Kohl) 21 * New version info and some output changes. 22 */ 23 24 #include "precomp.h" 25 #include <reactos/buildno.h> 26 #include <reactos/version.h> 27 28 VOID ShortVersion (VOID) 29 { 30 OSVERSIONINFO VersionInfo; 31 32 ConOutResPrintf(STRING_CMD_SHELLINFO, _T(KERNEL_RELEASE_STR), _T(KERNEL_VERSION_BUILD_STR)); 33 VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 34 35 memset(VersionInfo.szCSDVersion, 0, sizeof(VersionInfo.szCSDVersion)); 36 if (GetVersionEx(&VersionInfo)) 37 { 38 LPTSTR RosVersion; 39 SIZE_T RosVersionLen; 40 41 RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1; 42 RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) - 43 (RosVersion - VersionInfo.szCSDVersion); 44 if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7)) 45 { 46 ConOutResPrintf(STRING_VERSION_RUNVER, RosVersion); 47 } 48 } 49 ConOutPuts (_T("\n")); 50 } 51 52 53 #ifdef INCLUDE_CMD_VER 54 55 /* 56 * display shell version info internal command. 57 * 58 * 59 */ 60 INT cmd_ver (LPTSTR param) 61 { 62 INT i; 63 64 nErrorLevel = 0; 65 66 if (_tcsstr (param, _T("/?")) != NULL) 67 { 68 ConOutResPaging(TRUE,STRING_VERSION_HELP1); 69 return 0; 70 } 71 72 ShortVersion(); 73 74 /* Basic copyright notice */ 75 if (param[0] != _T('\0')) 76 { 77 78 ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others.")); 79 ConOutPuts (_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team")); 80 81 for (i = 0; param[i]; i++) 82 { 83 /* skip spaces */ 84 if (param[i] == _T(' ')) 85 continue; 86 87 if (param[i] == _T('/')) 88 { 89 /* is this a lone '/' ? */ 90 if (param[i + 1] == 0) 91 { 92 error_invalid_switch (_T(' ')); 93 return 1; 94 } 95 continue; 96 } 97 98 if (_totupper (param[i]) == _T('W')) 99 { 100 /* Warranty notice */ 101 ConOutResPuts(STRING_VERSION_HELP3); 102 } 103 else if (_totupper (param[i]) == _T('R')) 104 { 105 /* Redistribution notice */ 106 ConOutResPuts(STRING_VERSION_HELP4); 107 } 108 else if (_totupper (param[i]) == _T('C')) 109 { 110 /* Developer listing */ 111 ConOutResPuts(STRING_VERSION_HELP6); 112 ConOutResPuts(STRING_FREEDOS_DEV); 113 ConOutResPuts(STRING_VERSION_HELP7); 114 ConOutResPuts(STRING_REACTOS_DEV); 115 } 116 else 117 { 118 error_invalid_switch ((TCHAR)_totupper (param[i])); 119 return 1; 120 } 121 } 122 ConOutResPuts(STRING_VERSION_HELP5); 123 } 124 return 0; 125 } 126 127 #endif 128