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().
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 nErrorLevel
= 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 if (!SearchForExecutable (first
, szFullName
))
184 error_bad_command ();
188 /* check if this is a .BAT or .CMD file */
189 if (!_tcsicmp (_tcsrchr (szFullName
, _T('.')), _T(".bat")) ||
190 !_tcsicmp (_tcsrchr (szFullName
, _T('.')), _T(".cmd")))
193 DebugPrintf ("[BATCH: %s %s]\n", szFullName
, rest
);
195 Batch (szFullName
, first
, rest
);
199 /* exec the program */
201 TCHAR szFullCmdLine
[1024];
203 PROCESS_INFORMATION prci
;
207 DebugPrintf ("[EXEC: %s %s]\n", szFullName
, rest
);
210 /* build command line for CreateProcess() */
211 _tcscpy (szFullCmdLine
, szFullName
);
212 _tcscat (szFullCmdLine
, _T(" "));
213 _tcscat (szFullCmdLine
, rest
);
216 /* fill startup info */
217 memset (&stui
, 0, sizeof (STARTUPINFO
));
218 stui
.cb
= sizeof (STARTUPINFO
);
219 stui
.dwFlags
= STARTF_USESHOWWINDOW
;
220 stui
.wShowWindow
= SW_SHOWDEFAULT
;
223 if (CreateProcess (NULL
, szFullCmdLine
, NULL
, NULL
, FALSE
,
224 0, NULL
, NULL
, &stui
, &prci
))
226 if (CreateProcess (szFullName
, rest
, NULL
, NULL
, FALSE
,
227 0, NULL
, NULL
, &stui
, &prci
))
231 WaitForSingleObject (prci
.hProcess
, INFINITE
);
232 GetExitCodeProcess (prci
.hProcess
, &dwExitCode
);
233 nErrorLevel
= (INT
)dwExitCode
;
234 CloseHandle (prci
.hThread
);
235 CloseHandle (prci
.hProcess
);
239 ErrorMessage (GetLastError (),
240 "Error executing CreateProcess()!!\n");
247 * look through the internal commands and determine whether or not this
248 * command is one of them. If it is, call the command. If not, call
249 * execute to run it as an external program.
251 * line - the command line of the program to run
256 DoCommand (LPTSTR line
)
258 TCHAR com
[MAX_PATH
]; /* the first word in the command */
261 LPTSTR rest
= line
; /* pointer to the rest of the command line */
265 /* Skip over initial white space */
266 while (isspace (*rest
))
271 /* Anything to do ? */
274 /* Copy over 1st word as lower case */
275 while (!IsDelimiter (*rest
))
276 *cp
++ = _totlower (*rest
++);
278 /* Terminate first word */
281 /* Skip over whitespace to rest of line */
282 while (_istspace (*rest
))
285 /* Scan internal command table */
286 for (cmdptr
= cmds
;; cmdptr
++)
288 /* If end of table execute ext cmd */
289 if (cmdptr
->name
== NULL
)
295 if (!_tcscmp (com
, cmdptr
->name
))
297 cmdptr
->func (com
, rest
);
301 /* The following code handles the case of commands like CD which
302 * are recognised even when the command name and parameter are
303 * not space separated.
309 /* Get length of command name */
310 cl
= _tcslen (cmdptr
->name
);
312 if ((cmdptr
->flags
& CMD_SPECIAL
) &&
313 (!_tcsncmp (cmdptr
->name
, com
, cl
)) &&
314 (_tcschr (_T("\\.-"), *(com
+ cl
))))
316 /* OK its one of the specials...*/
318 /* Terminate first word properly */
321 /* Call with new rest */
322 cmdptr
->func (com
, cstart
+ cl
);
331 * process the command line and execute the appropriate functions
332 * full input/output redirection and piping are supported
335 VOID
ParseCommandLine (LPTSTR s
)
337 #ifdef FEATURE_REDIRECTION
338 TCHAR in
[CMDLINE_LENGTH
] = "";
339 TCHAR out
[CMDLINE_LENGTH
] = "";
340 TCHAR err
[CMDLINE_LENGTH
] = "";
341 TCHAR szTempPath
[MAX_PATH
] = _T(".\\");
342 TCHAR szFileName
[2][MAX_PATH
] = {"", ""};
343 HANDLE hFile
[2] = {INVALID_HANDLE_VALUE
, INVALID_HANDLE_VALUE
};
351 #endif /* FEATURE_REDIRECTION */
354 DebugPrintf ("ParseCommandLine: (\'%s\')]\n", s
);
357 #ifdef FEATURE_ALIASES
358 /* expand all aliases */
359 ExpandAlias (s
, CMDLINE_LENGTH
);
360 #endif /* FEATURE_ALIAS */
362 #ifdef FEATURE_REDIRECTION
363 /* find the temp path to store temporary files */
364 GetTempPath (MAX_PATH
, szTempPath
);
365 if (szTempPath
[_tcslen (szTempPath
) - 1] != _T('\\'))
366 _tcscat (szTempPath
, _T("\\"));
368 /* get the redirections from the command line */
369 num
= GetRedirection (s
, in
, out
, err
, &nRedirFlags
);
371 /* more efficient, but do we really need to do this? */
372 for (t
= in
; _istspace (*t
); t
++)
376 for (t
= out
; _istspace (*t
); t
++)
380 for (t
= err
; _istspace (*t
); t
++)
384 /* Set up the initial conditions ... */
385 /* preserve STDIN, STDOUT and STDERR handles */
386 hOldConIn
= GetStdHandle (STD_INPUT_HANDLE
);
387 hOldConOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
388 hOldConErr
= GetStdHandle (STD_ERROR_HANDLE
);
395 hFile
= CreateFile (in
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
396 FILE_ATTRIBUTE_NORMAL
, NULL
);
397 if (hFile
== INVALID_HANDLE_VALUE
)
399 ConErrPrintf ("Can't redirect input from file %s\n", in
);
403 if (!SetStdHandle (STD_INPUT_HANDLE
, hFile
))
405 ConErrPrintf ("Can't redirect input from file %s\n", in
);
409 DebugPrintf (_T("Input redirected from: %s\n"), in
);
413 /* Now do all but the last pipe command */
414 *szFileName
[0] = '\0';
415 hFile
[0] = INVALID_HANDLE_VALUE
;
419 /* Create unique temporary file name */
420 GetTempFileName (szTempPath
, "CMD", 0, szFileName
[1]);
422 /* Set current stdout to temporary file */
423 hFile
[1] = CreateFile (szFileName
[1], GENERIC_WRITE
, 0, NULL
,
424 TRUNCATE_EXISTING
, FILE_ATTRIBUTE_TEMPORARY
, NULL
);
425 SetStdHandle (STD_OUTPUT_HANDLE
, hFile
[1]);
429 /* close stdout file */
430 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
431 if ((hFile
[1] != INVALID_HANDLE_VALUE
) && (hFile
[1] != hOldConOut
))
433 CloseHandle (hFile
[1]);
434 hFile
[1] = INVALID_HANDLE_VALUE
;
437 /* close old stdin file */
438 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
439 if ((hFile
[0] != INVALID_HANDLE_VALUE
) && (hFile
[0] != hOldConIn
))
441 /* delete old stdin file, if it is a real file */
442 CloseHandle (hFile
[0]);
443 hFile
[0] = INVALID_HANDLE_VALUE
;
444 DeleteFile (szFileName
[0]);
445 *szFileName
[0] = _T('\0');
448 /* copy stdout file name to stdin file name */
449 _tcscpy (szFileName
[0], szFileName
[1]);
450 *szFileName
[1] = _T('\0');
452 /* open new stdin file */
453 hFile
[0] = CreateFile (szFileName
[0], GENERIC_READ
, 0, NULL
,
454 OPEN_EXISTING
, FILE_ATTRIBUTE_TEMPORARY
, NULL
);
455 SetStdHandle (STD_INPUT_HANDLE
, hFile
[0]);
457 s
= s
+ _tcslen (s
) + 1;
460 /* Now set up the end conditions... */
461 /* redirect STDOUT */
464 /* Final output to here */
467 hFile
= CreateFile (out
, GENERIC_WRITE
, 0, NULL
,
468 (nRedirFlags
& OUTPUT_APPEND
) ? OPEN_ALWAYS
: CREATE_ALWAYS
,
469 FILE_ATTRIBUTE_NORMAL
, NULL
);
470 if (hFile
== INVALID_HANDLE_VALUE
)
472 ConErrPrintf ("Can't redirect to file %s\n", out
);
476 if (!SetStdHandle (STD_OUTPUT_HANDLE
, hFile
))
478 ConErrPrintf ("Can't redirect to file %s\n", out
);
482 if (nRedirFlags
& OUTPUT_APPEND
)
486 if (GetFileType (hFile
) == FILE_TYPE_DISK
)
487 SetFilePointer (hFile
, 0, &lHighPos
, FILE_END
);
490 DebugPrintf (_T("Output redirected to: %s\n"), out
);
493 else if (hOldConOut
!= INVALID_HANDLE_VALUE
)
495 /* Restore original stdout */
496 HANDLE hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
497 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
498 if (hOldConOut
!= hOut
)
500 hOldConOut
= INVALID_HANDLE_VALUE
;
503 /* redirect STDERR */
506 /* Final output to here */
509 if (!_tcscmp (err
, out
))
512 DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
514 DuplicateHandle (GetCurrentProcess (), GetStdHandle (STD_OUTPUT_HANDLE
), GetCurrentProcess (),
515 &hFile
, 0, TRUE
, DUPLICATE_SAME_ACCESS
);
520 CreateFile (err
, GENERIC_WRITE
, 0, NULL
,
521 (nRedirFlags
& ERROR_APPEND
) ? OPEN_ALWAYS
: CREATE_ALWAYS
,
522 FILE_ATTRIBUTE_NORMAL
, NULL
);
523 if (hFile
== INVALID_HANDLE_VALUE
)
525 ConErrPrintf ("Can't redirect to file %s\n", err
);
529 if (!SetStdHandle (STD_ERROR_HANDLE
, hFile
))
531 ConErrPrintf ("Can't redirect to file %s\n", err
);
535 if (nRedirFlags
& ERROR_APPEND
)
539 if (GetFileType (hFile
) == FILE_TYPE_DISK
)
540 SetFilePointer (hFile
, 0, &lHighPos
, FILE_END
);
543 DebugPrintf (_T("Error redirected to: %s\n"), err
);
546 else if (hOldConErr
!= INVALID_HANDLE_VALUE
)
548 /* Restore original stderr */
549 HANDLE hErr
= GetStdHandle (STD_ERROR_HANDLE
);
550 SetStdHandle (STD_ERROR_HANDLE
, hOldConErr
);
551 if (hOldConErr
!= hErr
)
553 hOldConErr
= INVALID_HANDLE_VALUE
;
557 /* process final command */
560 #ifdef FEATURE_REDIRECTION
561 /* close old stdin file */
562 #if 0 /* buggy implementation */
563 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
564 if ((hFile
[0] != INVALID_HANDLE_VALUE
) &&
565 (hFile
[0] != hOldConIn
))
567 /* delete old stdin file, if it is a real file */
568 CloseHandle (hFile
[0]);
569 hFile
[0] = INVALID_HANDLE_VALUE
;
570 DeleteFile (szFileName
[0]);
571 *szFileName
[0] = _T('\0');
574 /* Restore original STDIN */
575 if (hOldConIn
!= INVALID_HANDLE_VALUE
)
577 HANDLE hIn
= GetStdHandle (STD_INPUT_HANDLE
);
578 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
579 if (hOldConIn
!= hIn
)
581 hOldConIn
= INVALID_HANDLE_VALUE
;
586 DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out
);
589 #endif /* buggy implementation */
592 if (hOldConIn
!= INVALID_HANDLE_VALUE
)
594 HANDLE hIn
= GetStdHandle (STD_INPUT_HANDLE
);
595 SetStdHandle (STD_INPUT_HANDLE
, hOldConIn
);
596 if (hIn
== INVALID_HANDLE_VALUE
)
599 DebugPrintf (_T("Previous STDIN is invalid!!\n"));
604 if (GetFileType (hIn
) == FILE_TYPE_DISK
)
608 CloseHandle (hFile
[0]);
609 hFile
[0] = INVALID_HANDLE_VALUE
;
610 DeleteFile (szFileName
[0]);
611 *szFileName
[0] = _T('\0');
616 DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
625 /* Restore original STDOUT */
626 if (hOldConOut
!= INVALID_HANDLE_VALUE
)
628 HANDLE hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
629 SetStdHandle (STD_OUTPUT_HANDLE
, hOldConOut
);
630 if (hOldConOut
!= hOut
)
632 hOldConOut
= INVALID_HANDLE_VALUE
;
635 /* Restore original STDERR */
636 if (hOldConErr
!= INVALID_HANDLE_VALUE
)
638 HANDLE hErr
= GetStdHandle (STD_ERROR_HANDLE
);
639 SetStdHandle (STD_ERROR_HANDLE
, hOldConErr
);
640 if (hOldConErr
!= hErr
)
642 hOldConErr
= INVALID_HANDLE_VALUE
;
644 #endif /* FEATURE_REDIRECTION */
649 * do the prompt/input/process loop
654 ProcessInput (BOOL bFlag
)
656 TCHAR commandline
[CMDLINE_LENGTH
];
657 TCHAR readline
[CMDLINE_LENGTH
];
662 /* JPP 19980807 - changed name so not to conflict with echo global */
667 /* if no batch input then... */
668 if (!(ip
= ReadBatchLine (&bEchoThisLine
)))
673 ReadCommand (readline
, CMDLINE_LENGTH
);
675 bEchoThisLine
= FALSE
;
699 if ((tp
= FindArg (*ip
- _T('0'))))
701 cp
= stpcpy (cp
, tp
);
709 cp
+= _stprintf (cp
, _T("%u"), nErrorLevel
);
714 if ((tp
= _tcschr (ip
, _T('%'))))
719 /* FIXME: This is just a quick hack!! */
720 /* Do a proper memory allocation!! */
721 if (GetEnvironmentVariable (ip
, evar
, 512))
722 cp
= stpcpy (cp
, evar
);
738 /* strip trailing spaces */
739 while ((--cp
>= commandline
) && _istspace (*cp
))
742 *(cp
+ 1) = _T('\0');
745 /* Echo batch file line */
749 ConOutPuts (commandline
);
754 ParseCommandLine (commandline
);
755 if (bEcho
&& !bIgnoreEcho
)
760 while (!bCanExit
|| !bExit
);
767 * control-break handler.
769 BOOL
BreakHandler (DWORD dwCtrlType
)
771 if ((dwCtrlType
== CTRL_C_EVENT
) ||
772 (dwCtrlType
== CTRL_BREAK_EVENT
))
774 bCtrlBreak
= TRUE
; /* indicate the break condition */
782 * show commands and options that are available.
791 ConOutPrintf (_T("\nInternal commands available:\n"));
798 ConOutPuts (cmdptr
->name
);
802 ConOutPrintf (_T("%-10s"), cmdptr
->name
);
810 /* print feature list */
811 ConOutPuts ("\nFeatures available:");
812 #ifdef FEATURE_ALIASES
813 ConOutPuts (" [aliases]");
815 #ifdef FEATURE_HISTORY
816 ConOutPuts (" [history]");
818 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
819 ConOutPuts (" [unix filename completion]");
821 #ifdef FEATURE_DIRECTORY_STACK
822 ConOutPuts (" [directory stack]");
824 #ifdef FEATURE_REDIRECTION
825 ConOutPuts (" [redirections and piping]");
832 * set up global initializations and process parameters
834 * argc - number of parameters to command.com
835 * argv - command-line parameters
838 static VOID
Initialize (int argc
, char *argv
[])
842 /* Added by Rob Lake 06/16/98. This enables the command.com
843 * to run the autoexec.bat at startup */
848 DebugPrintf ("[command args:\n");
849 for (x
= 0; x
< argc
; x
++)
851 DebugPrintf ("%d. %s\n", x
, argv
[x
]);
856 /* get version information */
857 osvi
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFO
);
858 GetVersionEx (&osvi
);
862 /* get default input and output console handles */
863 hOut
= GetStdHandle (STD_OUTPUT_HANDLE
);
864 hIn
= GetStdHandle (STD_INPUT_HANDLE
);
866 #ifdef INCLUDE_CMD_CHDIR
872 if (!_tcsncmp (argv
[1], _T("/?"), 2))
874 ConOutPuts (_T("Starts a new instance of the ReactOS command line interpreter\n\n"
875 "CMD [/P][/C]...\n\n"
882 for (i
= 1; i
< argc
; i
++)
884 if (!_tcsicmp (argv
[i
], _T("/p")))
886 if (!IsValidFileName (_T("\\autoexec.bat")))
888 #ifdef INCLUDE_CMD_DATE
891 #ifdef INCLUDE_CMD_TIME
896 ParseCommandLine ("\\autoexec.bat");
899 else if (!_tcsicmp (argv
[i
], _T("/c")))
901 /* This just runs a program and exits, RL: 06/16,21/98 */
902 char commandline
[CMDLINE_LENGTH
];
904 strcpy(commandline
, argv
[i
]);
907 strcat(commandline
, " ");
908 strcat(commandline
, argv
[i
]);
911 ParseCommandLine(commandline
);
913 /* HBP_003 { Fix return value when /C used }*/
914 ExitProcess (ProcessInput (TRUE
));
917 #ifdef INCLUDE_CMD_COLOR
918 else if (!_tcsnicmp (argv
[i
], _T("/t:"), 3))
920 /* process /t (color) argument */
921 wDefColor
= (WORD
)strtoul (&argv
[i
][3], NULL
, 16);
929 #ifdef FEATURE_DIR_STACK
930 /* initialize directory stack */
931 InitDirectoryStack ();
934 #ifdef INCLUDE_CMD_COLOR
935 /* set default colors */
936 SetScreenColor (wColor
);
942 /* Set COMSPEC environment variable */
945 SetEnvironmentVariable (_T("COMSPEC"), argv
[0]);
947 ConOutPrintf("argc: %d\n", argc
);
950 ConOutPrintf("argc is NULL\n");
958 /* add ctrl handler */
960 SetConsoleCtrlHandler (NULL
, TRUE
);
965 static VOID
Cleanup (VOID
)
968 #ifdef FEATURE_DIECTORY_STACK
969 /* destroy directory stack */
970 DestroyDirectoryStack ();
973 #ifdef INCLUDE_CMD_CHDIR
977 /* remove ctrl handler */
979 SetConsoleCtrlHandler ((PHANDLER_ROUTINE
)&BreakHandler
, FALSE
);
987 int main (int argc
, char *argv
[])
997 SetCurrentDirectory (_T("C:\\"));
1000 /* check switches on command-line */
1001 Initialize (argc
, argv
);
1003 /* call prompt routine */
1004 nExitCode
= ProcessInput (FALSE
);
1006 /* do the cleanup */