2 * CMD.C - command-line interface.
7 * 17 Jun 1994 (Tim Norman)
10 * 08 Aug 1995 (Matt Rains)
11 * I have cleaned up the source code. changes now bring this source
12 * into guidelines for recommended programming practice.
14 * A added the the standard FreeDOS GNU licence test to the
15 * initialize() function.
17 * Started to replace puts() with printf(). this will help
18 * standardize output. please follow my lead.
20 * I have added some constants to help making changes easier.
22 * 15 Dec 1995 (Tim Norman)
23 * major rewrite of the code to make it more efficient and add
24 * redirection support (finally!)
26 * 06 Jan 1996 (Tim Norman)
27 * finished adding redirection support! Changed to use our own
28 * exec code (MUCH thanks to Svante Frey!!)
30 * 29 Jan 1996 (Tim Norman)
31 * added support for CHDIR, RMDIR, MKDIR, and ERASE, as per
32 * suggestion of Steffan Kaiser
34 * changed "file not found" error message to "bad command or
35 * filename" thanks to Dustin Norman for noticing that confusing
38 * changed the format to call internal commands (again) so that if
39 * they want to split their commands, they can do it themselves
40 * (none of the internal functions so far need that much power, anyway)
42 * 27 Aug 1996 (Tim Norman)
43 * added in support for Oliver Mueller's ALIAS command
45 * 14 Jun 1997 (Steffan Kaiser)
46 * added ctrl-break handling and error level
48 * 16 Jun 1998 (Rob Lake)
49 * Runs command.com if /P is specified in command line. Command.com
50 * also stays permanent. If /C is in the command line, starts the
51 * program next in the line.
53 * 21 Jun 1998 (Rob Lake)
54 * Fixed up /C so that arguments for the program
56 * 08-Jul-1998 (John P. Price)
57 * Now sets COMSPEC environment variable
58 * misc clean up and optimization
59 * added date and time commands
60 * changed to using spawnl instead of exec. exec does not copy the
61 * environment to the child process!
63 * 14 Jul 1998 (Hans B Pufal)
64 * Reorganised source to be more efficient and to more closely
65 * follow MS-DOS conventions. (eg %..% environment variable
66 * replacement works form command line as well as batch file.
68 * New organisation also properly support nested batch files.
70 * New command table structure is half way towards providing a
71 * system in which COMMAND will find out what internal commands
74 * 24 Jul 1998 (Hans B Pufal) [HBP_003]
75 * Fixed return value when called with /C option
77 * 27 Jul 1998 John P. Price
78 * added config.h include
80 * 28 Jul 1998 John P. Price
81 * added showcmds function to show commands and options available
83 * 07-Aug-1998 (John P Price <linux-guru@gcfl.net>)
84 * Fixed carrage return output to better match MSDOS with echo
85 * on or off. (marked with "JPP 19980708")
87 * 07-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
88 * First ReactOS release.
89 * Extended length of commandline buffers to 512.
91 * 13-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
92 * Added COMSPEC environment variable.
93 * Added "/t" support (color) on cmd command line.
95 * 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
96 * Added help text ("cmd /?").
98 * 25-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
99 * Unicode and redirection safe!
100 * Fixed redirections and piping.
101 * Piping is based on temporary files, but basic support
102 * for anonymous pipes already exists.
104 * 27-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
105 * Replaced spawnl() by CreateProcess().
108 // #define WIN32_LEAN_AND_MEAN
113 // #include <tchar.h>
121 #define CMDLINE_LENGTH 512
124 BOOL bExit
= FALSE
; /* indicates EXIT was typed */
125 BOOL bCanExit
= TRUE
; /* indicates if this shell is exitable */
126 BOOL bCtrlBreak
= FALSE
; /* Ctrl-Break or Ctrl-C hit */
127 BOOL bIgnoreEcho
= FALSE
; /* Ignore 'newline' before 'cls' */
128 INT errorlevel
= 0; /* Errorlevel of last launched external program */
133 #ifdef INCLUDE_CMD_COLOR
134 WORD wColor
= FOREGROUND_BLUE
| FOREGROUND_RED
| FOREGROUND_GREEN
; /* current color */
135 WORD wDefColor
= FOREGROUND_BLUE
| FOREGROUND_RED
| FOREGROUND_GREEN
; /* default color */
139 extern COMMAND cmds
[]; /* The internal command table */
143 * is character a delimeter when used on first word?
147 static BOOL
IsDelimiter (TCHAR c
)
149 return (c
== _T('/') || c
== _T('=') || c
== _T('\0') || _istspace (c
));
154 * This command (in first) was not found in the command table
156 * first - first word on command line
157 * rest - rest of command line
161 Execute (LPTSTR first
, LPTSTR rest
)
163 TCHAR szFullName
[MAX_PATH
];
165 /* check for a drive change */
166 if (!_tcscmp (first
+ 1, _T(":")) && _istalpha (*first
))
168 TCHAR szPath
[MAX_PATH
];
170 _tcscpy (szPath
, _T("A:"));
171 szPath
[0] = _totupper (*first
);
172 SetCurrentDirectory (szPath
);
173 GetCurrentDirectory (MAX_PATH
, szPath
);
174 if (szPath
[0] != (TCHAR
)_totupper (*first
))
175 ConErrPuts (INVALIDDRIVE
);
180 /* get the PATH environment variable and parse it */
181 /* search the PATH environment variable for the binary */
182 find_which (first
, szFullName
);
184 if (szFullName
[0] == _T('\0'))
186 error_bad_command ();
190 /* check if this is a .BAT or .CMD file */
191 if (!_tcsicmp (_tcsrchr (szFullName
, _T('.')), _T(".bat")) ||
192 !_tcsicmp (_tcsrchr (szFullName
, _T('.')), _T(".cmd")))
195 DebugPrintf ("[BATCH: %s %s]\n", szFullName
, rest
);
197 Batch (szFullName
, first
, rest
);
201 /* exec the program */
202 TCHAR szFullCmdLine
[1024];
203 PROCESS_INFORMATION prci
;
208 DebugPrintf ("[EXEC: %s %s]\n", szFullName
, rest
);
210 /* build command line for CreateProcess() */
211 _tcscpy (szFullCmdLine
, szFullName
);
212 _tcscat (szFullCmdLine
, " ");
213 _tcscat (szFullCmdLine
, rest
);
215 /* fill startup info */
216 memset (&stui
, 0, sizeof (STARTUPINFO
));
217 stui
.cb
= sizeof (STARTUPINFO
);
218 stui
.dwFlags
= STARTF_USESHOWWINDOW
;
219 stui
.wShowWindow
= SW_SHOWDEFAULT
;
221 if (CreateProcess (NULL
, szFullCmdLine
, NULL
, NULL
, FALSE
,
222 0, NULL
, NULL
, &stui
, &prci
))
224 WaitForSingleObject (prci
.hProcess
, INFINITE
);
225 GetExitCodeProcess (prci
.hProcess
, &errorlevel
);
226 CloseHandle (prci
.hThread
);
227 CloseHandle (prci
.hProcess
);
231 ErrorMessage (GetLastError (),
232 "Error executing CreateProcess()!!\n");
239 * look through the internal commands and determine whether or not this
240 * command is one of them. If it is, call the command. If not, call
241 * execute to run it as an external program.
243 * line - the command line of the program to run
248 DoCommand (LPTSTR line
)
250 TCHAR com
[MAX_PATH
]; /* the first word in the command */
253 LPTSTR rest
= line
; /* pointer to the rest of the command line */
257 /* Skip over initial white space */
258 while (isspace (*rest
))
263 /* Anything to do ? */
266 /* Copy over 1st word as lower case */
267 while (!IsDelimiter (*rest
))
268 *cp
++ = _totlower (*rest
++);
270 /* Terminate first word */
273 /* Skip over whitespace to rest of line */
274 while (_istspace (*rest
))
277 /* Scan internal command table */
278 for (cmdptr
= cmds
;; cmdptr
++)
280 /* If end of table execute ext cmd */
281 if (cmdptr
->name
== NULL
)
287 if (!_tcscmp (com
, cmdptr
->name
))
289 cmdptr
->func (com
, rest
);
293 /* The following code handles the case of commands like CD which
294 * are recognised even when the command name and parameter are
295 * not space separated.
301 /* Get length of command name */
302 cl
= _tcslen (cmdptr
->name
);
304 if ((cmdptr
->flags
& CMD_SPECIAL
) &&
305 (!_tcsncmp (cmdptr
->name
, com
, cl
)) &&
306 (_tcschr (_T("\\.-"), *(com
+ cl
))))
308 /* OK its one of the specials...*/
310 /* Terminate first word properly */
313 /* Call with new rest */
314 cmdptr
->func (com
, cstart
+ cl
);
323 * process the command line and execute the appropriate functions
324 * full input/output redirection and piping are supported
327 VOID
ParseCommandLine (LPTSTR s
)
329 #ifdef FEATURE_REDIRECTION
330 TCHAR in
[CMDLINE_LENGTH
] = "";
331 TCHAR out
[CMDLINE_LENGTH
] = "";
332 TCHAR err
[CMDLINE_LENGTH
] = "";
333 TCHAR szTempPath
[MAX_PATH
] = _T(".\\");
334 TCHAR szFileName
[2][MAX_PATH
] = {"", ""};
335 HANDLE hFile
[2] = {INVALID_HANDLE_VALUE
, INVALID_HANDLE_VALUE
};
343 #endif /* FEATURE_REDIRECTION */
346 DebugPrintf ("ParseCommandLine: (\'%s\')]\n", s
);
349 #ifdef FEATURE_ALIASES
350 /* expand all aliases */
351 ExpandAlias (s
, CMDLINE_LENGTH
);
352 #endif /* FEATURE_ALIAS */
354 #ifdef FEATURE_REDIRECTION
355 /* find the temp path to store temporary files */
356 GetTempPath (MAX_PATH
, szTempPath
);
357 if (szTempPath
[_tcslen (szTempPath
) - 1] != _T('\\'))
358 _tcscat (szTempPath
, _T("\\"));
360 /* get the redirections from the command line */
361 num
= GetRedirection (s
, in
, out
, err
, &nRedirFlags
);
363 /* more efficient, but do we really need to do this? */
364 for (t
= in
; _istspace (*t
); t
++)
368 for (t
= out
; _istspace (*t
); t
++)
372 for (t
= err
; _istspace (*t
); t
++)
376 /* Set up the initial conditions ... */
377 /* preserve STDIN, STDOUT and STDERR handles */
378 hOldConIn
= GetStdHandle (STD_INPUT_HANDLE
);
379 hOldConOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
380 hOldConErr
= GetStdHandle (STD_ERROR_HANDLE
);
387 hFile
= CreateFile (in
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
388 FILE_ATTRIBUTE_NORMAL
, NULL
);
389 if (hFile
== INVALID_HANDLE_VALUE
)
391 ConErrPrintf ("Can't redirect input from file %s\n", in
);
395 if (!SetStdHandle (STD_INPUT_HANDLE
, hFile
))
397 ConErrPrintf ("Can't redirect input from file %s\n", in
);
401 DebugPrintf (_T("Input redirected from: %s\n"), in
);
405 /* Now do all but the last pipe command */
406 *szFileName
[0] = '\0';
407 hFile
[0] = INVALID_HANDLE_VALUE
;
411 /* Create unique temporary file name */
412 GetTempFileName (szTempPath
, "CMD", 0, szFileName
[1]);
414 /* Set current stdout to temporary file */
415 hFile
[1] = CreateFile (szFileName
[1], GENERIC_WRITE
, 0, NULL
,
416 TRUNCATE_EXISTING
, FILE_ATTRIBUTE_TEMPORARY
, NULL
);
417 SetStdHandle (STD_OUTPUT_HANDLE
, hFile
[1]);
421 /* close stdout file */
422 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
423 if ((hFile
[1] != INVALID_HANDLE_VALUE
) && (hFile
[1] != hOldConOut
))
425 CloseHandle (hFile
[1]);
426 hFile
[1] = INVALID_HANDLE_VALUE
;
429 /* close old stdin file */
430 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
431 if ((hFile
[0] != INVALID_HANDLE_VALUE
) && (hFile
[0] != hOldConIn
))
433 /* delete old stdin file, if it is a real file */
434 CloseHandle (hFile
[0]);
435 hFile
[0] = INVALID_HANDLE_VALUE
;
436 DeleteFile (szFileName
[0]);
437 *szFileName
[0] = _T('\0');
440 /* copy stdout file name to stdin file name */
441 _tcscpy (szFileName
[0], szFileName
[1]);
442 *szFileName
[1] = _T('\0');
444 /* open new stdin file */
445 hFile
[0] = CreateFile (szFileName
[0], GENERIC_READ
, 0, NULL
,
446 OPEN_EXISTING
, FILE_ATTRIBUTE_TEMPORARY
, NULL
);
447 SetStdHandle (STD_INPUT_HANDLE
, hFile
[0]);
449 s
= s
+ _tcslen (s
) + 1;
452 /* Now set up the end conditions... */
453 /* redirect STDOUT */
456 /* Final output to here */
459 hFile
= CreateFile (out
, GENERIC_WRITE
, 0, NULL
,
460 (nRedirFlags
& OUTPUT_APPEND
) ? OPEN_ALWAYS
: CREATE_ALWAYS
,
461 FILE_ATTRIBUTE_NORMAL
, NULL
);
462 if (hFile
== INVALID_HANDLE_VALUE
)
464 ConErrPrintf ("Can't redirect to file %s\n", out
);
468 if (!SetStdHandle (STD_OUTPUT_HANDLE
, hFile
))
470 ConErrPrintf ("Can't redirect to file %s\n", out
);
474 if (nRedirFlags
& OUTPUT_APPEND
)
478 if (GetFileType (hFile
) == FILE_TYPE_DISK
)
479 SetFilePointer (hFile
, 0, &lHighPos
, FILE_END
);
482 DebugPrintf (_T("Output redirected to: %s\n"), out
);
485 else if (hOldConOut
!= INVALID_HANDLE_VALUE
)
487 /* Restore original stdout */
488 HANDLE hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
489 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
490 if (hOldConOut
!= hOut
)
492 hOldConOut
= INVALID_HANDLE_VALUE
;
495 /* redirect STDERR */
498 /* Final output to here */
501 if (!_tcscmp (err
, out
))
504 DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
506 DuplicateHandle (GetCurrentProcess (), GetStdHandle (STD_OUTPUT_HANDLE
), GetCurrentProcess (),
507 &hFile
, 0, TRUE
, DUPLICATE_SAME_ACCESS
);
512 CreateFile (err
, GENERIC_WRITE
, 0, NULL
,
513 (nRedirFlags
& ERROR_APPEND
) ? OPEN_ALWAYS
: CREATE_ALWAYS
,
514 FILE_ATTRIBUTE_NORMAL
, NULL
);
515 if (hFile
== INVALID_HANDLE_VALUE
)
517 ConErrPrintf ("Can't redirect to file %s\n", err
);
521 if (!SetStdHandle (STD_ERROR_HANDLE
, hFile
))
523 ConErrPrintf ("Can't redirect to file %s\n", err
);
527 if (nRedirFlags
& ERROR_APPEND
)
531 if (GetFileType (hFile
) == FILE_TYPE_DISK
)
532 SetFilePointer (hFile
, 0, &lHighPos
, FILE_END
);
535 DebugPrintf (_T("Error redirected to: %s\n"), err
);
538 else if (hOldConErr
!= INVALID_HANDLE_VALUE
)
540 /* Restore original stderr */
541 HANDLE hErr
= GetStdHandle (STD_ERROR_HANDLE
);
542 SetStdHandle (STD_ERROR_HANDLE
, hOldConErr
);
543 if (hOldConErr
!= hErr
)
545 hOldConErr
= INVALID_HANDLE_VALUE
;
549 /* process final command */
552 #ifdef FEATURE_REDIRECTION
553 /* close old stdin file */
554 #if 0 /* buggy implementation */
555 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
556 if ((hFile
[0] != INVALID_HANDLE_VALUE
) &&
557 (hFile
[0] != hOldConIn
))
559 /* delete old stdin file, if it is a real file */
560 CloseHandle (hFile
[0]);
561 hFile
[0] = INVALID_HANDLE_VALUE
;
562 DeleteFile (szFileName
[0]);
563 *szFileName
[0] = _T('\0');
566 /* Restore original STDIN */
567 if (hOldConIn
!= INVALID_HANDLE_VALUE
)
569 HANDLE hIn
= GetStdHandle (STD_INPUT_HANDLE
);
570 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
571 if (hOldConIn
!= hIn
)
573 hOldConIn
= INVALID_HANDLE_VALUE
;
578 DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out
);
581 #endif /* buggy implementation */
584 if (hOldConIn
!= INVALID_HANDLE_VALUE
)
586 HANDLE hIn
= GetStdHandle (STD_INPUT_HANDLE
);
587 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
588 if (hIn
== INVALID_HANDLE_VALUE
)
591 DebugPrintf (_T("Previous STDIN is invalid!!\n"));
596 if (GetFileType (hIn
) == FILE_TYPE_DISK
)
600 CloseHandle (hFile
[0]);
601 hFile
[0] = INVALID_HANDLE_VALUE
;
602 DeleteFile (szFileName
[0]);
603 *szFileName
[0] = _T('\0');
608 DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
617 /* Restore original STDOUT */
618 if (hOldConOut
!= INVALID_HANDLE_VALUE
)
620 HANDLE hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
621 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
622 if (hOldConOut
!= hOut
)
624 hOldConOut
= INVALID_HANDLE_VALUE
;
627 /* Restore original STDERR */
628 if (hOldConErr
!= INVALID_HANDLE_VALUE
)
630 HANDLE hErr
= GetStdHandle (STD_ERROR_HANDLE
);
631 SetStdHandle (STD_ERROR_HANDLE
, hOldConErr
);
632 if (hOldConErr
!= hErr
)
634 hOldConErr
= INVALID_HANDLE_VALUE
;
636 #endif /* FEATURE_REDIRECTION */
641 * do the prompt/input/process loop
646 ProcessInput (BOOL bFlag
)
648 TCHAR commandline
[CMDLINE_LENGTH
];
649 TCHAR readline
[CMDLINE_LENGTH
];
654 /* JPP 19980807 - changed name so not to conflict with echo global */
659 /* if no batch input then... */
660 if (!(ip
= ReadBatchLine (&bEchoThisLine
)))
665 ReadCommand (readline
, CMDLINE_LENGTH
);
667 bEchoThisLine
= FALSE
;
691 if (tp
= FindArg (*ip
- _T('0')))
693 cp
= stpcpy (cp
, tp
);
701 cp
+= wsprintf (cp
, _T("%u"), errorlevel
);
706 if (tp
= _tcschr (ip
, _T('%')))
711 /* FIXME: This is just a quick hack!! */
712 /* Do a proper memory allocation!! */
713 if (GetEnvironmentVariable (ip
, evar
, 512))
714 cp
= stpcpy (cp
, evar
);
730 /* strip trailing spaces */
731 while ((--cp
>= commandline
) && _istspace (*cp
))
734 *(cp
+ 1) = _T('\0');
737 /* Echo batch file line */
741 ConOutPuts (commandline
);
746 ParseCommandLine (commandline
);
747 if (bEcho
&& !bIgnoreEcho
)
752 while (!bCanExit
|| !bExit
);
759 * control-break handler.
761 BOOL
BreakHandler (DWORD dwCtrlType
)
763 if ((dwCtrlType
== CTRL_C_EVENT
) ||
764 (dwCtrlType
== CTRL_BREAK_EVENT
))
766 bCtrlBreak
= TRUE
; /* indicate the break condition */
774 * show commands and options that are available.
783 ConOutPrintf (_T("\nInternal commands available:\n"));
790 ConOutPuts (cmdptr
->name
);
794 ConOutPrintf (_T("%-10s"), cmdptr
->name
);
802 /* print feature list */
803 ConOutPuts ("\nFeatures available:");
804 #ifdef FEATURE_ALIASES
805 ConOutPuts (" [aliases]");
807 #ifdef FEATURE_HISTORY
808 ConOutPuts (" [history]");
810 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
811 ConOutPuts (" [unix filename completion]");
813 #ifdef FEATURE_DIRECTORY_STACK
814 ConOutPuts (" [directory stack]");
816 #ifdef FEATURE_REDIRECTION
817 ConOutPuts (" [redirections and piping]");
824 * set up global initializations and process parameters
826 * argc - number of parameters to command.com
827 * argv - command-line parameters
830 static VOID
Initialize (int argc
, char *argv
[])
834 /* Added by Rob Lake 06/16/98. This enables the command.com
835 * to run the autoexec.bat at startup */
840 DebugPrintf ("[command args:\n");
841 for (x
= 0; x
< argc
; x
++)
843 DebugPrintf ("%d. %s\n", x
, argv
[x
]);
848 /* get version information */
849 osvi
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFO
);
850 GetVersionEx (&osvi
);
854 /* get default input and output console handles */
855 hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
856 hIn
= GetStdHandle (STD_INPUT_HANDLE
);
858 #ifdef INCLUDE_CMD_CHDIR
864 if (!_tcsncmp (argv
[1], _T("/?"), 2))
866 ConOutPuts (_T("Starts a new instance of the ReactOS command line interpreter\n\n"
867 "CMD [/P][/C]...\n\n"
874 for (i
= 1; i
< argc
; i
++)
876 if (!_tcsicmp (argv
[i
], _T("/p")))
878 if (!IsValidFileName (_T("\\autoexec.bat")))
880 #ifdef INCLUDE_CMD_DATE
883 #ifdef INCLUDE_CMD_TIME
888 ParseCommandLine ("\\autoexec.bat");
891 else if (!_tcsicmp (argv
[i
], _T("/c")))
893 /* This just runs a program and exits, RL: 06/16,21/98 */
894 char commandline
[CMDLINE_LENGTH
];
896 strcpy(commandline
, argv
[i
]);
899 strcat(commandline
, " ");
900 strcat(commandline
, argv
[i
]);
903 ParseCommandLine(commandline
);
905 /* HBP_003 { Fix return value when /C used }*/
906 ExitProcess (ProcessInput (TRUE
));
909 #ifdef INCLUDE_CMD_COLOR
910 else if (!_tcsnicmp (argv
[i
], _T("/t:"), 3))
912 /* process /t (color) argument */
913 wDefColor
= (WORD
)strtoul (&argv
[i
][3], NULL
, 16);
921 #ifdef FEATURE_DIR_STACK
922 /* initialize directory stack */
923 InitDirectoryStack ();
926 #ifdef INCLUDE_CMD_COLOR
927 /* set default colors */
928 SetScreenColor (wColor
);
934 /* Set COMSPEC environment variable */
935 SetEnvironmentVariable (_T("COMSPEC"), argv
[0]);
937 /* add ctrl handler */
938 SetConsoleCtrlHandler (NULL
, TRUE
);
942 static VOID
Cleanup (VOID
)
945 #ifdef FEATURE_DIECTORY_STACK
946 /* destroy directory stack */
947 DestroyDirectoryStack ();
950 #ifdef INCLUDE_CMD_CHDIR
954 /* remove ctrl handler */
955 // SetConsoleCtrlHandler ((PHANDLER_ROUTINE)&BreakHandler, FALSE);
962 int main (int argc
, char *argv
[])
969 /* check switches on command-line */
970 Initialize (argc
, argv
);
972 /* call prompt routine */
973 nExitCode
= ProcessInput (FALSE
);