| 227 |
dpurdie |
1 |
/*
|
|
|
2 |
* MS-DOS SHELL - Data Declarations
|
|
|
3 |
*
|
|
|
4 |
* MS-DOS SHELL - Copyright (c) 1990,4 Data Logic Limited and Charles Forsyth
|
|
|
5 |
*
|
|
|
6 |
* This code is based on (in part) the shell program written by Charles
|
|
|
7 |
* Forsyth and is subject to the following copyright restrictions:
|
|
|
8 |
*
|
|
|
9 |
* 1. Redistribution and use in source and binary forms are permitted
|
|
|
10 |
* provided that the above copyright notice is duplicated in the
|
|
|
11 |
* source form and the copyright notice in file sh6.c is displayed
|
|
|
12 |
* on entry to the program.
|
|
|
13 |
*
|
|
|
14 |
* 2. The sources (or parts thereof) or objects generated from the sources
|
|
|
15 |
* (or parts of sources) cannot be sold under any circumstances.
|
|
|
16 |
*
|
|
|
17 |
* $Header: /cvsroot/device/DEVL/UTILS/SH/SH6.C,v 1.3 2004/11/04 02:47:59 ayoung Exp $
|
|
|
18 |
*
|
|
|
19 |
* $Log: SH6.C,v $
|
|
|
20 |
* Revision 1.3 2004/11/04 02:47:59 ayoung
|
|
|
21 |
* handle upto 8 PATH definitions
|
|
|
22 |
*
|
|
|
23 |
* Revision 1.2 2004/05/10 09:30:06 ayoung
|
|
|
24 |
* improved Path/PATH handling
|
|
|
25 |
* Quote CreateProcess arg0 if embedded spaces are encountered
|
|
|
26 |
* Native NT exec dont need to check command line length
|
|
|
27 |
* Warning when '@' within redirect list
|
|
|
28 |
* DEBUG_EXEC option, split from PRINT_EXEC option and improved
|
|
|
29 |
*
|
|
|
30 |
* Revision 1.1 2002/08/02 06:49:33 adamy
|
|
|
31 |
* imported (reference only)
|
|
|
32 |
*
|
|
|
33 |
* Revision 1.1 2001/07/20 05:55:42 ayoung
|
|
|
34 |
* WIN32 support
|
|
|
35 |
*
|
|
|
36 |
* Revision 1.1.1.1 1999/12/02 01:11:13 gordonh
|
|
|
37 |
* UTIL
|
|
|
38 |
*
|
|
|
39 |
* Revision 2.15 1994/08/25 20:49:11 istewart
|
|
|
40 |
* MS Shell 2.3 Release
|
|
|
41 |
*
|
|
|
42 |
* Revision 2.14 1994/02/23 09:23:38 istewart
|
|
|
43 |
* Beta 233 updates
|
|
|
44 |
*
|
|
|
45 |
* Revision 2.13 1994/02/01 10:25:20 istewart
|
|
|
46 |
* Release 2.3 Beta 2, including first NT port
|
|
|
47 |
*
|
|
|
48 |
* Revision 2.12 1994/01/11 17:55:25 istewart
|
|
|
49 |
* Release 2.3 Beta 0 patches
|
|
|
50 |
*
|
|
|
51 |
* Revision 2.11 1993/11/09 10:39:49 istewart
|
|
|
52 |
* Beta 226 checking
|
|
|
53 |
*
|
|
|
54 |
* Revision 2.10 1993/08/25 16:03:57 istewart
|
|
|
55 |
* Beta 225 - see Notes file
|
|
|
56 |
*
|
|
|
57 |
* Revision 2.9 1993/07/02 10:21:35 istewart
|
|
|
58 |
* 224 Beta fixes
|
|
|
59 |
*
|
|
|
60 |
* Revision 2.8 1993/06/14 11:00:12 istewart
|
|
|
61 |
* More changes for 223 beta
|
|
|
62 |
*
|
|
|
63 |
* Revision 2.7 1993/06/02 09:52:35 istewart
|
|
|
64 |
* Beta 223 Updates - see Notes file
|
|
|
65 |
*
|
|
|
66 |
* Revision 2.6 1993/02/16 16:03:15 istewart
|
|
|
67 |
* Beta 2.22 Release
|
|
|
68 |
*
|
|
|
69 |
* Revision 2.5 1993/01/26 18:35:09 istewart
|
|
|
70 |
* Release 2.2 beta 0
|
|
|
71 |
*
|
|
|
72 |
* Revision 2.4 1992/12/14 10:54:56 istewart
|
|
|
73 |
* BETA 215 Fixes and 2.1 Release
|
|
|
74 |
*
|
|
|
75 |
* Revision 2.3 1992/11/06 10:03:44 istewart
|
|
|
76 |
* 214 Beta test updates
|
|
|
77 |
*
|
|
|
78 |
* Revision 2.2 1992/09/03 18:54:45 istewart
|
|
|
79 |
* Beta 213 Updates
|
|
|
80 |
*
|
|
|
81 |
* Revision 2.1 1992/07/10 10:52:48 istewart
|
|
|
82 |
* 211 Beta updates
|
|
|
83 |
*
|
|
|
84 |
* Revision 2.0 1992/04/13 17:39:09 Ian_Stewartson
|
|
|
85 |
* MS-Shell 2.0 Baseline release
|
|
|
86 |
*
|
|
|
87 |
*
|
|
|
88 |
*/
|
|
|
89 |
|
|
|
90 |
#include <sys/types.h>
|
|
|
91 |
#include <sys/stat.h>
|
|
|
92 |
#include <stddef.h>
|
|
|
93 |
#include <stdio.h>
|
|
|
94 |
#include <setjmp.h>
|
|
|
95 |
#include <stdlib.h>
|
|
|
96 |
#include <limits.h>
|
|
|
97 |
#include <unistd.h>
|
|
|
98 |
#include "sh.h"
|
|
|
99 |
|
|
|
100 |
#if (OS_TYPE == OS_UNIX)
|
|
|
101 |
# include <sys/utsname.h>
|
|
|
102 |
static char *Copy_Right1 = "%s %s SH Version 2.41 (%s) - %s (OS %s.%s)\n";
|
|
|
103 |
#else
|
|
|
104 |
static char *Copy_Right1 = "%s %s SH Version 2.41 (%s) - %s (OS %d.%d)\n";
|
|
|
105 |
#endif
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
#if (OS_TYPE == OS_OS2)
|
|
|
109 |
char *LIT_OSname = "OS2";
|
|
|
110 |
# if (OS_SIZE == OS_32)
|
|
|
111 |
static char *Copy_Right2 = "(32-Bit)";
|
|
|
112 |
# else
|
|
|
113 |
static char *Copy_Right2 = "(16-Bit)";
|
|
|
114 |
# endif
|
|
|
115 |
#elif (OS_TYPE == OS_DOS)
|
|
|
116 |
char *LIT_OSname = "MS-DOS";
|
|
|
117 |
# if (OS_SIZE == OS_32)
|
|
|
118 |
static char *Copy_Right2 = "(32-Bit)";
|
|
|
119 |
# else
|
|
|
120 |
static char *Copy_Right2 = "(16-Bit)";
|
|
|
121 |
# endif
|
|
|
122 |
#elif (OS_TYPE == OS_NT)
|
|
|
123 |
char *LIT_OSname = "MS-WNT";
|
|
|
124 |
static char *Copy_Right2 = "";
|
|
|
125 |
#elif (OS_TYPE == OS_UNIX)
|
|
|
126 |
char *LIT_OSname = "UNIX";
|
|
|
127 |
#endif
|
|
|
128 |
|
|
|
129 |
static char *Copy_Right3 = "Copyright (c) Data Logic Ltd and Charles Forsyth 1990, 94\n";
|
|
|
130 |
|
|
|
131 |
#if (OS_TYPE == OS_DOS) && (OS_SIZE == OS_32)
|
|
|
132 |
bool IgnoreHardErrors = FALSE;/* Hard Error Flag */
|
|
|
133 |
#endif
|
|
|
134 |
|
|
|
135 |
int BaseOS; /* Underlying OS */
|
|
|
136 |
char **ParameterArray = (char **)NULL; /* Parameter array */
|
|
|
137 |
int ParameterCount = 0; /* # entries in parameter array */
|
|
|
138 |
int ExitStatus; /* Exit status */
|
|
|
139 |
bool ExpansionErrorDetected;
|
|
|
140 |
/* interactive (talking-type wireless) */
|
|
|
141 |
bool InteractiveFlag = FALSE;
|
|
|
142 |
bool ProcessingEXECCommand; /* Exec mode */
|
|
|
143 |
bool UseConsoleBuffer = FALSE;/* Flag from dofc to */
|
|
|
144 |
/* GetConsoleInput */
|
|
|
145 |
int AllowMultipleLines; /* Allow continuation onto */
|
|
|
146 |
/* Next line */
|
|
|
147 |
int Current_Event = 0; /* Current history event */
|
|
|
148 |
bool ChangeInitLoad = FALSE; /* Change load .ini pt. */
|
|
|
149 |
unsigned int ShellGlobalFlags = 0; /* Other global flags */
|
|
|
150 |
int MaxNumberofFDs = 20; /* Max no of file descriptors */
|
|
|
151 |
|
|
|
152 |
int DisabledVariables = 0; /* Disabled variables */
|
|
|
153 |
int StartCursorPosition = -1;/* Start cursor position */
|
|
|
154 |
|
|
|
155 |
unsigned int SW_intr; /* Interrupt flag */
|
|
|
156 |
#ifndef OS_SWAPPING
|
|
|
157 |
bool IgnoreInterrupts = FALSE;/* Ignore interrupts flag */
|
|
|
158 |
#else
|
|
|
159 |
/* Swap mode */
|
|
|
160 |
#endif
|
|
|
161 |
|
|
|
162 |
Break_C *Break_List; /* Break list for FOR/WHILE */
|
|
|
163 |
Break_C *Return_List; /* Return list for RETURN */
|
|
|
164 |
Break_C *SShell_List; /* SubShell list for EXIT */
|
|
|
165 |
bool RestrictedShellFlag = FALSE; /* Restricted shell */
|
|
|
166 |
/* History processing enabled flag */
|
|
|
167 |
bool HistoryEnabled = FALSE;
|
|
|
168 |
|
|
|
169 |
void *FunctionTree = (void *)NULL; /* Function tree */
|
|
|
170 |
FunctionList *CurrentFunction = (FunctionList *)NULL;
|
|
|
171 |
void *AliasTree = (void *)NULL; /* Alias tree */
|
|
|
172 |
|
|
|
173 |
#if (OS_TYPE != OS_DOS)
|
|
|
174 |
void *JobTree = (void *)NULL; /* job tree */
|
|
|
175 |
bool ExitWithJobsActive = FALSE; /* Exit flag */
|
|
|
176 |
int CurrentJob = 0; /* No current */
|
|
|
177 |
int PreviousJob = 0; /* Previous Job */
|
|
|
178 |
#endif
|
|
|
179 |
|
|
|
180 |
#if (OS_TYPE == OS_OS2)
|
|
|
181 |
/*
|
|
|
182 |
* Session Info
|
|
|
183 |
*/
|
|
|
184 |
char *SessionEndQName = (char *)NULL; /* Queue */
|
|
|
185 |
|
|
|
186 |
/*
|
|
|
187 |
* Special flag for EMX parameters
|
|
|
188 |
*/
|
|
|
189 |
|
|
|
190 |
bool EMXStyleParameters = FALSE;
|
|
|
191 |
#endif
|
|
|
192 |
|
|
|
193 |
/*
|
|
|
194 |
* redirection
|
|
|
195 |
*/
|
|
|
196 |
|
|
|
197 |
Save_IO *SSave_IO; /* Save IO array */
|
|
|
198 |
int NSave_IO_E = 0; /* Number of entries in Save IO array */
|
|
|
199 |
int MSave_IO_E = 0; /* Max Number of entries in SSave_IO */
|
|
|
200 |
S_SubShell *SubShells; /* Save Vars array */
|
|
|
201 |
int NSubShells = 0; /* Number of entries in SubShells */
|
|
|
202 |
int MSubShells = 0; /* Max Number of entries in SubShells */
|
|
|
203 |
int LastNumberBase = -1; /* Last base entered */
|
|
|
204 |
|
|
|
205 |
int InterruptTrapPending; /* Trap pending */
|
|
|
206 |
int Execute_stack_depth; /* execute function recursion */
|
|
|
207 |
/* depth */
|
|
|
208 |
void *VariableTree = (void *)NULL; /* Variable dictionary */
|
|
|
209 |
VariableList *CurrentDirectory; /* Current directory */
|
|
|
210 |
char *LastUserPrompt; /* Last prompt output */
|
|
|
211 |
char *LastUserPrompt1; /* Alternate Last prompt output */
|
|
|
212 |
char IFS[] = "IFS"; /* Inter-field separator */
|
|
|
213 |
char PS1[] = "PS1"; /* Prompt 1 */
|
|
|
214 |
char PS2[] = "PS2"; /* Prompt 2 */
|
|
|
215 |
char PS3[] = "PS3"; /* Prompt 3 */
|
|
|
216 |
char PS4[] = "PS4"; /* Prompt 4 */
|
|
|
217 |
char PathLiteral[] = "PATH";
|
|
|
218 |
char UserLiteral[] = "USER";
|
|
|
219 |
char CDPathLiteral[] = "CDPATH";
|
|
|
220 |
char CurrentDirLiteral[] = ".";
|
|
|
221 |
char ParentDirLiteral[] = "..";
|
|
|
222 |
char PathExtsLiteral[] = "PATHEXTS";
|
|
|
223 |
char HomeVariableName[] = "HOME";
|
|
|
224 |
char ShellVariableName[] = "SHELL";
|
|
|
225 |
char HistoryFileVariable[] = "HISTFILE";
|
|
|
226 |
char HistorySizeVariable[] = "HISTSIZE";
|
|
|
227 |
char *ComspecVariable= "COMSPEC";
|
|
|
228 |
char *ParameterCountVariable = "#";
|
|
|
229 |
char *ShellOptionsVariable = "-";
|
|
|
230 |
char StatusVariable[] = "?";
|
|
|
231 |
char SecondsVariable[] = "SECONDS";
|
|
|
232 |
char RandomVariable[] = "RANDOM";
|
|
|
233 |
char LineCountVariable[] = "LINENO";
|
|
|
234 |
char *RootDirectory = "x:/";
|
|
|
235 |
|
|
|
236 |
#if (OS_TYPE != OS_DOS)
|
|
|
237 |
char WinTitleVariable[] = "WINTITLE";
|
|
|
238 |
#endif
|
|
|
239 |
|
|
|
240 |
char *OldPWDVariable = "OLDPWD";
|
|
|
241 |
char *PWDVariable = "PWD";
|
|
|
242 |
char *ENVVariable = "ENV";
|
|
|
243 |
|
|
|
244 |
#if (OS_TYPE == OS_DOS) || (OS_TYPE == OS_NT)
|
|
|
245 |
char BATExtension[] = ".bat";
|
|
|
246 |
#else
|
|
|
247 |
char BATExtension[] = ".cmd";
|
|
|
248 |
#endif
|
|
|
249 |
|
|
|
250 |
char SHELLExtension[] = ".sh";
|
|
|
251 |
char KSHELLExtension[] = ".ksh";
|
|
|
252 |
char EXEExtension[] = ".exe";
|
|
|
253 |
char COMExtension[] = ".com";
|
|
|
254 |
char *NotFound = "not found";
|
|
|
255 |
char *BasicErrorMessage = "%s: %s";
|
|
|
256 |
char *DirectorySeparator = "/";
|
|
|
257 |
char LastWordVariable[] = "_";
|
|
|
258 |
char OptArgVariable[] = "OPTARG";
|
|
|
259 |
char OptIndVariable[] = "OPTIND";
|
|
|
260 |
char MailCheckVariable[] = "MAILCHECK";
|
|
|
261 |
char FCEditVariable[] = "FCEDIT";
|
|
|
262 |
char EditorVariable[] = "EDITOR";
|
|
|
263 |
char VisualVariable[] = "VISUAL";
|
|
|
264 |
char Trap_DEBUG[] = "~DEBUG";
|
|
|
265 |
char Trap_ERR[] = "~ERR";
|
|
|
266 |
char LIT_dos[] = "DOS";
|
|
|
267 |
char *LIT_NewLine = "\n";
|
|
|
268 |
char *LIT_BadID = "bad identifier";
|
|
|
269 |
char LIT_export[] = "export";
|
|
|
270 |
char LIT_exit[] = "exit";
|
|
|
271 |
char LIT_exec[] = "exec";
|
|
|
272 |
char LIT_done[] = "done";
|
|
|
273 |
char LIT_history[] = "history";
|
|
|
274 |
char LIT_REPLY[] = "REPLY";
|
|
|
275 |
char LIT_LINES[] = "LINES";
|
|
|
276 |
char LIT_COLUMNS[] = "COLUMNS";
|
|
|
277 |
char *ListVarFormat = "%s=%s\n";
|
|
|
278 |
char *Outofmemory1 = "Out of memory";
|
|
|
279 |
char *LIT_Emsg = "%s: %s (%s)";
|
|
|
280 |
char *LIT_2Strings = "%s %s";
|
|
|
281 |
char *LIT_3Strings = "%s %s%s";
|
|
|
282 |
char *LIT_SyntaxError = "Syntax error";
|
|
|
283 |
char *LIT_BadArray = "%s: bad array value";
|
|
|
284 |
char *LIT_ArrayRange = "%s: subscript out of range";
|
|
|
285 |
char *LIT_BNumber = "[%d]";
|
|
|
286 |
char *LIT_Invalidfunction = "Invalid function name";
|
|
|
287 |
char *LIT_AllowTTY = "SH_ALLOWTTYPIPES";
|
|
|
288 |
char *LIT_IsReadonly = "is read-only";
|
|
|
289 |
char LIT_Test[] = "[[";
|
|
|
290 |
int MaximumColumns = 80; /* Max columns */
|
|
|
291 |
int MaximumLines = 25; /* Max Lines */
|
|
|
292 |
|
|
|
293 |
/*
|
|
|
294 |
* Fopen modes, different between IBM OS/2 2.x and the rest
|
|
|
295 |
*/
|
|
|
296 |
|
|
|
297 |
#ifdef __IBMC__
|
|
|
298 |
char *sOpenReadMode = "r"; /* Open file in read mode */
|
|
|
299 |
char *sOpenWriteMode = "w"; /* Open file in write mode */
|
|
|
300 |
char *sOpenAppendMode = "w+";/* Open file in append mode */
|
|
|
301 |
char *sOpenWriteBinaryMode = "wb";/* Open file in append mode */
|
|
|
302 |
#else
|
|
|
303 |
char *sOpenReadMode = "rt"; /* Open file in read mode */
|
|
|
304 |
char *sOpenWriteMode = "wt"; /* Open file in write mode */
|
|
|
305 |
char *sOpenAppendMode = "wt+";/* Open file in append mode */
|
|
|
306 |
char *sOpenWriteBinaryMode = "wb";/* Open file in append mode */
|
|
|
307 |
#endif
|
|
|
308 |
|
|
|
309 |
#if (OS_TYPE == OS_OS2)
|
|
|
310 |
STARTDATA *SessionControlBlock; /* Start a session info */
|
|
|
311 |
|
|
|
312 |
STARTDATA PM_SessionControlBlock = { /* PM session defaults */
|
|
|
313 |
sizeof (STARTDATA), /* Length */
|
|
|
314 |
SSF_RELATED_CHILD, /* Related */
|
|
|
315 |
SSF_FGBG_FORE, /* FgBg */
|
|
|
316 |
SSF_TRACEOPT_NONE, /* TraceOpt */
|
|
|
317 |
(char *)NULL, /* PgmTitle */
|
|
|
318 |
(char *)NULL, /* PgmName */
|
|
|
319 |
(PBYTE)NULL, /* PgmInputs */
|
|
|
320 |
(PBYTE)NULL, /* TermQ */
|
|
|
321 |
(char *)1, /* Environment */
|
|
|
322 |
SSF_INHERTOPT_PARENT, /* InheritOpt */
|
|
|
323 |
SSF_TYPE_PM, /* SessionType */
|
|
|
324 |
(char *)NULL, /* IconFile */
|
|
|
325 |
0L, /* PgmHandle */
|
|
|
326 |
SSF_CONTROL_NOAUTOCLOSE, /* PgmControl */
|
|
|
327 |
0, /* InitXPos */
|
|
|
328 |
0, /* InitYPos */
|
|
|
329 |
100, /* InitXSize */
|
|
|
330 |
100 /* InitYSize */
|
|
|
331 |
};
|
|
|
332 |
|
|
|
333 |
STARTDATA DOS_SessionControlBlock = { /* DOS session defaults */
|
|
|
334 |
sizeof (STARTDATA), /* Length */
|
|
|
335 |
SSF_RELATED_CHILD, /* Related */
|
|
|
336 |
SSF_FGBG_FORE, /* FgBg */
|
|
|
337 |
SSF_TRACEOPT_NONE, /* TraceOpt */
|
|
|
338 |
(char *)NULL, /* PgmTitle */
|
|
|
339 |
(char *)NULL, /* PgmName */
|
|
|
340 |
(PBYTE)NULL, /* PgmInputs */
|
|
|
341 |
(PBYTE)NULL, /* TermQ */
|
|
|
342 |
(char *)1, /* Environment */
|
|
|
343 |
SSF_INHERTOPT_PARENT, /* InheritOpt */
|
|
|
344 |
SSF_TYPE_VDM, /* SessionType */
|
|
|
345 |
(char *)NULL, /* IconFile */
|
|
|
346 |
0L, /* PgmHandle */
|
|
|
347 |
SSF_CONTROL_NOAUTOCLOSE, /* PgmControl */
|
|
|
348 |
0, /* InitXPos */
|
|
|
349 |
0, /* InitYPos */
|
|
|
350 |
100, /* InitXSize */
|
|
|
351 |
100 /* InitYSize */
|
|
|
352 |
};
|
|
|
353 |
#endif
|
|
|
354 |
|
|
|
355 |
/*
|
|
|
356 |
* Parser information
|
|
|
357 |
*/
|
|
|
358 |
|
|
|
359 |
char CurrentLexIdentifier [IDENT+1];/* Identifier */
|
|
|
360 |
Source *source; /* yyparse/ScanNextToken source */
|
|
|
361 |
YYSTYPE yylval; /* result from ScanNextToken */
|
|
|
362 |
int yynerrs; /* Parse error flag */
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
/*
|
|
|
366 |
* Global program mode information
|
|
|
367 |
*/
|
|
|
368 |
|
|
|
369 |
ExeMode ExecProcessingMode; /* Global Program mode */
|
|
|
370 |
|
|
|
371 |
/*
|
|
|
372 |
* Character Types array
|
|
|
373 |
*/
|
|
|
374 |
|
|
|
375 |
unsigned char CharTypes [UCHAR_MAX + 1];
|
|
|
376 |
|
|
|
377 |
/*
|
|
|
378 |
* Modified getopt values
|
|
|
379 |
*/
|
|
|
380 |
|
|
|
381 |
int OptionIndex = 1; /* optind */
|
|
|
382 |
int OptionStart; /* start character */
|
|
|
383 |
char *OptionArgument; /* optarg */
|
|
|
384 |
|
|
|
385 |
/*
|
|
|
386 |
* Device directory. The length of this string is defined by the variable
|
|
|
387 |
* LEN_DEVICE_NAME_HEADER
|
|
|
388 |
*/
|
|
|
389 |
|
|
|
390 |
char *DeviceNameHeader = "/dev/";
|
|
|
391 |
|
|
|
392 |
int MemoryAreaLevel;/* Current allocation area */
|
|
|
393 |
long flags = 0L; /* Command line flags */
|
|
|
394 |
char null[] = ""; /* Null value */
|
|
|
395 |
char ConsoleLineBuffer[LINE_MAX + 1]; /* Console line buffer */
|
|
|
396 |
|
|
|
397 |
/*
|
|
|
398 |
* Current environment
|
|
|
399 |
*/
|
|
|
400 |
|
|
|
401 |
ShellFileEnvironment e = {
|
|
|
402 |
(ErrorPoint)NULL, /* Error handler */
|
|
|
403 |
0L, /* IO Map for this level */
|
|
|
404 |
(char *)NULL, /* Current line buffer */
|
|
|
405 |
(ShellFileEnvironment *)NULL, /* Previous Env pointer */
|
|
|
406 |
};
|
|
|
407 |
|
|
|
408 |
/*
|
|
|
409 |
* Some defines to print version and release info
|
|
|
410 |
*/
|
|
|
411 |
|
|
|
412 |
#define str(s) # s
|
|
|
413 |
#define xstr(s) str(s)
|
|
|
414 |
|
|
|
415 |
/*
|
|
|
416 |
* The only bit of code in this module prints the version number
|
|
|
417 |
*/
|
|
|
418 |
|
|
|
419 |
void PrintVersionNumber (FILE *fp)
|
|
|
420 |
{
|
|
|
421 |
#if (OS_TYPE == OS_UNIX)
|
|
|
422 |
char *Copy_Right2 = null;
|
|
|
423 |
char *_osmajor = null;
|
|
|
424 |
char *_osminor = null;
|
|
|
425 |
struct utsname name;
|
|
|
426 |
|
|
|
427 |
if (!uname (&name))
|
|
|
428 |
{
|
|
|
429 |
Copy_Right2 = name.machine;
|
|
|
430 |
_osmajor = name.release;
|
|
|
431 |
_osminor = name.version;
|
|
|
432 |
}
|
|
|
433 |
#endif
|
|
|
434 |
fprintf (fp, Copy_Right1, LIT_OSname, Copy_Right2, xstr (RELEASE),
|
|
|
435 |
__DATE__, OS_VERS_N, OS_VERS_M);
|
|
|
436 |
fputs (Copy_Right3, fp);
|
|
|
437 |
}
|