-/* $Id: cmd.c,v 1.21 2000/05/26 06:06:05 phreak Exp $
+/* $Id: cmd.c,v 1.22 2000/07/19 06:58:12 ekohl Exp $
*
* CMD.C - command-line interface.
*
static VOID
ShowCommands (VOID)
{
- LPCOMMAND cmdptr;
- INT y;
-
+ /* print command list */
ConOutPrintf (_T("\nInternal commands available:\n"));
- y = 0;
- cmdptr = cmds;
- while (cmdptr->name)
- {
- if (++y == 8)
- {
- ConOutPuts (cmdptr->name);
- y = 0;
- }
- else
- ConOutPrintf (_T("%-10s"), cmdptr->name);
-
- cmdptr++;
- }
-
- if (y != 0)
- ConOutChar ('\n');
+ PrintCommandList ();
/* print feature list */
ConOutPuts ("\nFeatures available:");
{
/* This just runs a program and exits */
++i;
- _tcscpy (commandline, argv[i]);
- while (argv[++i])
+ if (argv[i])
{
- _tcscat (commandline, " ");
- _tcscat (commandline, argv[i]);
+ _tcscpy (commandline, argv[i]);
+ while (argv[++i])
+ {
+ _tcscat (commandline, " ");
+ _tcscat (commandline, argv[i]);
+ }
+
+ ParseCommandLine(commandline);
+ ExitProcess (ProcessInput (TRUE));
+ }
+ else
+ {
+ ExitProcess (0);
}
-
- ParseCommandLine(commandline);
- ExitProcess (ProcessInput (TRUE));
}
else if (!_tcsicmp (argv[i], _T("/k")))
{
/* This just runs a program and remains */
++i;
- _tcscpy (commandline, argv[i]);
- while (argv[++i])
+ if (argv[i])
{
- _tcscat (commandline, " ");
- _tcscat (commandline, argv[i]);
+ _tcscpy (commandline, argv[i]);
+ while (argv[++i])
+ {
+ _tcscat (commandline, " ");
+ _tcscat (commandline, argv[i]);
+ }
+
+ ParseCommandLine(commandline);
}
-
- ParseCommandLine(commandline);
}
#ifdef INCLUDE_CMD_COLOR
else if (!_tcsnicmp (argv[i], _T("/t:"), 3))
SetFileApisToOEM ();
if( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &Info ) == FALSE )
- printf( "GetConsoleScreenBufferInfo: Error: %d\n", GetLastError() );
+ printf( "GetConsoleScreenBufferInfo: Error: %ld\n", GetLastError() );
wColor = Info.wAttributes;
wDefColor = wColor;
/* check switches on command-line */
-/* $Id: cmd.h,v 1.19 2000/02/01 18:29:11 paolopan Exp $
+/* $Id: cmd.h,v 1.20 2000/07/19 06:58:13 ekohl Exp $
*
* CMD.H - header file for the modules in CMD.EXE
*
/* Prototypes for CMDTABLE.C */
#define CMD_SPECIAL 1
#define CMD_BATCHONLY 2
+#define CMD_HIDE 4
typedef struct tagCOMMAND
{
extern COMMAND cmds[]; /* The internal command table */
+VOID PrintCommandList (VOID);
+
/* Prototypes for COLOR.C */
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
#endif
{_T("echo"), 0, CommandEcho},
+ {_T("echo."), CMD_HIDE, CommandEcho},
{_T("echos"), 0, CommandEchos},
{_T("echoerr"), 0, CommandEchoerr},
+ {_T("echoerr."), CMD_HIDE, CommandEchoerr},
{_T("echoserr"), 0, CommandEchoserr},
#ifdef INCLUDE_CMD_DEL
{NULL, 0, NULL}
};
+
+VOID PrintCommandList (VOID)
+{
+ LPCOMMAND cmdptr;
+ INT y;
+
+ y = 0;
+ cmdptr = cmds;
+ while (cmdptr->name)
+ {
+ if (!(cmdptr->flags & CMD_HIDE))
+ {
+ if (++y == 8)
+ {
+ ConOutPuts (cmdptr->name);
+ y = 0;
+ }
+ else
+ {
+ ConOutPrintf (_T("%-10s"), cmdptr->name);
+ }
+ }
+
+ cmdptr++;
+ }
+
+ if (y != 0)
+ ConOutChar ('\n');
+}
+
/* EOF */
-#define CMD_VER "0.1"
+#define CMD_VER "0.1.1"
#define CMD_VER_RC CMD_VER"\0"
-/* $Id: echo.c,v 1.3 1999/10/03 22:15:33 ekohl Exp $
+/* $Id: echo.c,v 1.4 2000/07/19 06:58:13 ekohl Exp $
*
* ECHO.C - internal echo commands.
*
*
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready!
+ *
+ * 13-Jul-2000 (Eric Kohl <ekohl@rz-online.de>)
+ * Implemented 'echo.' and 'echoerr.'.
*/
#include "config.h"
if (!_tcsncmp (param, _T("/?"), 2))
{
- ConOutPuts ("Displays a message or switches command echoing on or off.\n\n"
- "ECHO [ON | OFF]\nECHO [message]\n\n"
- "Type ECHO without a parameter to display the current ECHO setting.");
+ ConOutPuts ("Displays a message or switches command echoing on or off.\n"
+ "\n"
+ " ECHO [ON | OFF]\n"
+ " ECHO [message]\n"
+ " ECHO. prints an empty line\n"
+ "\n"
+ "Type ECHO without a parameter to display the current ECHO setting.");
return 0;
}
- if (_tcsicmp (param, D_OFF) == 0)
- bEcho = FALSE;
- else if (_tcsicmp (param, D_ON) == 0)
- bEcho = TRUE;
- else if (*param)
- ConOutPuts (param);
+ if (_tcsicmp (cmd, _T("echo.")) == 0)
+ {
+ if (param[0] == 0)
+ ConOutChar (_T('\n'));
+ else
+ ConOutPuts (param);
+ }
else
- ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
+ {
+ if (_tcsicmp (param, D_OFF) == 0)
+ bEcho = FALSE;
+ else if (_tcsicmp (param, D_ON) == 0)
+ bEcho = TRUE;
+ else if (*param)
+ ConOutPuts (param);
+ else
+ ConOutPrintf (_T("ECHO is %s\n"), bEcho ? D_ON : D_OFF);
+ }
return 0;
}
{
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
"\n"
- "ECHOS message\n");
+ " ECHOS message");
return 0;
}
{
ConOutPuts ("Displays a message to the standard error.\n"
"\n"
- "ECHOERR message");
+ " ECHOERR message\n"
+ " ECHOERR. prints an empty line");
return 0;
}
- if (*param)
+ if (_tcsicmp (cmd, _T("echoerr.")) == 0)
+ {
+ if (param[0] == 0)
+ ConErrChar (_T('\n'));
+ else
+ ConErrPuts (param);
+ }
+ else if (*param)
+ {
ConErrPuts (param);
+ }
return 0;
}
{
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
"\n"
- "ECHOSERR message\n");
+ " ECHOSERR message");
return 0;
}
if (*param)
- ConOutPrintf ("%s", param);
+ ConOutPrintf (_T("%s"), param);
return 0;
}
09-Apr-2000 ReactOS CMD version 0.1 (EricKohl <ekohl@rz-online.de>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Fixed bug in COPY command. CMD crashed if source file didn't exist.
+
+13-Jul-2000 ReactOS CMD version 0.1.1 (EricKohl <ekohl@rz-online.de>
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Implemented 'ECHO.' and 'ECHOERR.' commands.
#include "cmd.h"
-extern COMMAND cmds[]; /* The internal command table, used in '?' */
-
-
#ifdef INCLUDE_CMD_CHDIR
static LPTSTR lpLastPath;
INT CommandShowCommands (LPTSTR cmd, LPTSTR param)
{
- LPCOMMAND cmdptr;
- INT y;
-
- y = 0;
- cmdptr = cmds;
- while (cmdptr->name)
- {
- if (++y == 8)
- {
- ConOutPuts (cmdptr->name);
- y = 0;
- }
- else
- ConOutPrintf (_T("%-10s"), cmdptr->name);
-
- cmdptr++;
- }
-
- if (y != 0)
- ConOutChar (_T('\n'));
-
+ PrintCommandList ();
return 0;
}
-ReactOS command line interpreter CMD version 0.1
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ReactOS command line interpreter CMD version 0.1.1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ReactOS command line interpreter CMD is derived from FreeCOM, the
FreeDOS command line interpreter.
Cmd can be built in two different versions. A full version for use under
Windows 9x or Windows NT and a reduced version for use under ReactOS.
-Note: The full version won't runder ReactOS and the reduced version is not
+Note: The full version won't run on ReactOS and the reduced version is not
usable under Win 9x/NT.
To build the full version, make sure the symbol '__REACTOS__' is NOT defined
Current Features
~~~~~~~~~~~~~~~~
-
- environment handling with prompt and path support.
- directory utilities.
- command-line history with doskey-like features.
- input/output redirection and piping.
- alias support.
- filename completion (use TAB)
+ (this is still incomplete)
Credits
~~~~~~~
-
FreeDOS developers:
normat@rpi.edu (Tim Norman)
mrains@apanix.apana.org.au (Matt Rains)
Hans B Pufal <hansp@digiweb.com>
ReactOS developers:
- Eric Kohl <ekohl@abo.rhein-zeitung.de>
+ Eric Kohl <ekohl@rz-online.de>
Emanuele Aliberti <ea@iol.it>
Paolo Pantaleo <paolopan@freemail.it>
Bugs
~~~~
+Batch file handling is still untested or buggy. Please report
+any bug you find.
-Please report bugs to Eric Kohl <ekohl@abo.rhein-zeitung.de>.
+Please report bugs to Eric Kohl <ekohl@rz-online.de>.
Good luck
More ideas?
- Eric Kohl <ekohl@abo.rhein-zeitung.de>
\ No newline at end of file
+ Eric Kohl <ekohl@rz-online.de>