51d0d6aa50d87b84e9c2a181b27cc94027aac760
[reactos.git] / rosapps / cmd / ver.c
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 <ekohl@abo.rhein-zeitung.de>)
18 * Unicode and redirection safe!
19 *
20 * 26-Feb-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
21 * New version info and some output changes.
22 */
23
24 #include "config.h"
25
26 #include <windows.h>
27 #include <tchar.h>
28 #include <string.h>
29 #include <ctype.h>
30
31 #include "cmd.h"
32
33
34
35 VOID ShortVersion (VOID)
36 {
37 ConOutPuts (_T("\n"
38 SHELLINFO "\n"
39 SHELLVER "\n"));
40 }
41
42
43 #ifdef INCLUDE_CMD_VER
44
45 /*
46 * display shell version info internal command.
47 *
48 *
49 */
50 INT cmd_ver (LPTSTR cmd, LPTSTR param)
51 {
52 INT i;
53
54 if (_tcsstr (param, _T("/?")) != NULL)
55 {
56 ConOutPuts (_T("Displays shell version information\n"
57 "\n"
58 "VER [/C][/R][/W]\n"
59 "\n"
60 " /C Displays credits.\n"
61 " /R Displays redistribution information.\n"
62 " /W Displays warranty information."));
63 return 0;
64 }
65
66 ConOutPuts (_T("\n"
67 SHELLINFO "\n"
68 SHELLVER "\n"
69 "\n"
70 "Copyright (C) 1994-1998 Tim Norman and others."));
71 ConOutPuts (_T("Copyright (C) 1998-2001 Eric Kohl and others."));
72
73 /* Basic copyright notice */
74 if (param[0] == _T('\0'))
75 {
76 ConOutPuts (_T("\n"SHELLINFO
77 " comes with ABSOLUTELY NO WARRANTY; for details\n"
78 "type: `ver /w'. This is free software, and you are welcome to redistribute\n"
79 "it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n"
80 "listing of credits."));
81 }
82 else
83 {
84 for (i = 0; param[i]; i++)
85 {
86 /* skip spaces */
87 if (param[i] == _T(' '))
88 continue;
89
90 if (param[i] == _T('/'))
91 {
92 /* is this a lone '/' ? */
93 if (param[i + 1] == 0)
94 {
95 error_invalid_switch (_T(' '));
96 return 1;
97 }
98 continue;
99 }
100
101 if (_totupper (param[i]) == _T('W'))
102 {
103 /* Warranty notice */
104 ConOutPuts (_T("\n This program is distributed in the hope that it will be useful,\n"
105 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
106 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
107 " GNU General Public License for more details."));
108 }
109 else if (_totupper (param[i]) == _T('R'))
110 {
111 /* Redistribution notice */
112 ConOutPuts (_T("\n This program is free software; you can redistribute it and/or modify\n"
113 " it under the terms of the GNU General Public License as published by\n"
114 " the Free Software Foundation; either version 2 of the License, or\n"
115 " (at your option) any later version."));
116 }
117 else if (_totupper (param[i]) == _T('C'))
118 {
119 /* Developer listing */
120 ConOutPuts (_T("\n"
121 "FreeDOS version written by:\n"
122 " Tim Norman Matt Rains\n"
123 " Evan Jeffrey Steffen Kaiser\n"
124 " Svante Frey Oliver Mueller\n"
125 " Aaron Kaufman Marc Desrochers\n"
126 " Rob Lake John P Price\n"
127 " Hans B Pufal\n"
128 "\n"
129 "ReactOS version written by:\n"
130 " Eric Kohl Emanuele Aliberti\n"
131 " Paolo Pantaleo\n"));
132 }
133 else
134 {
135 error_invalid_switch ((TCHAR)_totupper (param[i]));
136 return 1;
137 }
138 }
139 }
140
141 ConOutPuts (_T("\n"
142 "Send bug reports to <ekohl@rz-online.de>.\n"
143 "Updates are available at: http://www.reactos.com"));
144 return 0;
145 }
146
147 #endif