mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:05:41 +00:00
Fixed 'echo.' and 'echoerr.'
svn path=/trunk/; revision=1267
This commit is contained in:
parent
fb416bf8e2
commit
6041051d6a
9 changed files with 121 additions and 85 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $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.
|
* CMD.C - command-line interface.
|
||||||
*
|
*
|
||||||
|
@ -898,27 +898,9 @@ VOID RemoveBreakHandler (VOID)
|
||||||
static VOID
|
static VOID
|
||||||
ShowCommands (VOID)
|
ShowCommands (VOID)
|
||||||
{
|
{
|
||||||
LPCOMMAND cmdptr;
|
/* print command list */
|
||||||
INT y;
|
|
||||||
|
|
||||||
ConOutPrintf (_T("\nInternal commands available:\n"));
|
ConOutPrintf (_T("\nInternal commands available:\n"));
|
||||||
y = 0;
|
PrintCommandList ();
|
||||||
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');
|
|
||||||
|
|
||||||
/* print feature list */
|
/* print feature list */
|
||||||
ConOutPuts ("\nFeatures available:");
|
ConOutPuts ("\nFeatures available:");
|
||||||
|
@ -1024,28 +1006,38 @@ Initialize (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* This just runs a program and exits */
|
/* This just runs a program and exits */
|
||||||
++i;
|
++i;
|
||||||
_tcscpy (commandline, argv[i]);
|
if (argv[i])
|
||||||
while (argv[++i])
|
|
||||||
{
|
{
|
||||||
_tcscat (commandline, " ");
|
_tcscpy (commandline, argv[i]);
|
||||||
_tcscat (commandline, argv[i]);
|
while (argv[++i])
|
||||||
}
|
{
|
||||||
|
_tcscat (commandline, " ");
|
||||||
|
_tcscat (commandline, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ParseCommandLine(commandline);
|
ParseCommandLine(commandline);
|
||||||
ExitProcess (ProcessInput (TRUE));
|
ExitProcess (ProcessInput (TRUE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExitProcess (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!_tcsicmp (argv[i], _T("/k")))
|
else if (!_tcsicmp (argv[i], _T("/k")))
|
||||||
{
|
{
|
||||||
/* This just runs a program and remains */
|
/* This just runs a program and remains */
|
||||||
++i;
|
++i;
|
||||||
_tcscpy (commandline, argv[i]);
|
if (argv[i])
|
||||||
while (argv[++i])
|
|
||||||
{
|
{
|
||||||
_tcscat (commandline, " ");
|
_tcscpy (commandline, argv[i]);
|
||||||
_tcscat (commandline, argv[i]);
|
while (argv[++i])
|
||||||
}
|
{
|
||||||
|
_tcscat (commandline, " ");
|
||||||
|
_tcscat (commandline, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ParseCommandLine(commandline);
|
ParseCommandLine(commandline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef INCLUDE_CMD_COLOR
|
#ifdef INCLUDE_CMD_COLOR
|
||||||
else if (!_tcsnicmp (argv[i], _T("/t:"), 3))
|
else if (!_tcsnicmp (argv[i], _T("/t:"), 3))
|
||||||
|
@ -1174,7 +1166,7 @@ int main (int argc, char *argv[])
|
||||||
SetFileApisToOEM ();
|
SetFileApisToOEM ();
|
||||||
|
|
||||||
if( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &Info ) == FALSE )
|
if( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &Info ) == FALSE )
|
||||||
printf( "GetConsoleScreenBufferInfo: Error: %d\n", GetLastError() );
|
printf( "GetConsoleScreenBufferInfo: Error: %ld\n", GetLastError() );
|
||||||
wColor = Info.wAttributes;
|
wColor = Info.wAttributes;
|
||||||
wDefColor = wColor;
|
wDefColor = wColor;
|
||||||
/* check switches on command-line */
|
/* check switches on command-line */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $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
|
* CMD.H - header file for the modules in CMD.EXE
|
||||||
*
|
*
|
||||||
|
@ -125,6 +125,7 @@ VOID ReadCommand (LPTSTR, INT);
|
||||||
/* Prototypes for CMDTABLE.C */
|
/* Prototypes for CMDTABLE.C */
|
||||||
#define CMD_SPECIAL 1
|
#define CMD_SPECIAL 1
|
||||||
#define CMD_BATCHONLY 2
|
#define CMD_BATCHONLY 2
|
||||||
|
#define CMD_HIDE 4
|
||||||
|
|
||||||
typedef struct tagCOMMAND
|
typedef struct tagCOMMAND
|
||||||
{
|
{
|
||||||
|
@ -135,6 +136,8 @@ typedef struct tagCOMMAND
|
||||||
|
|
||||||
extern COMMAND cmds[]; /* The internal command table */
|
extern COMMAND cmds[]; /* The internal command table */
|
||||||
|
|
||||||
|
VOID PrintCommandList (VOID);
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for COLOR.C */
|
/* Prototypes for COLOR.C */
|
||||||
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
|
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
|
||||||
|
|
|
@ -97,8 +97,10 @@ COMMAND cmds[] =
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{_T("echo"), 0, CommandEcho},
|
{_T("echo"), 0, CommandEcho},
|
||||||
|
{_T("echo."), CMD_HIDE, CommandEcho},
|
||||||
{_T("echos"), 0, CommandEchos},
|
{_T("echos"), 0, CommandEchos},
|
||||||
{_T("echoerr"), 0, CommandEchoerr},
|
{_T("echoerr"), 0, CommandEchoerr},
|
||||||
|
{_T("echoerr."), CMD_HIDE, CommandEchoerr},
|
||||||
{_T("echoserr"), 0, CommandEchoserr},
|
{_T("echoserr"), 0, CommandEchoserr},
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_DEL
|
#ifdef INCLUDE_CMD_DEL
|
||||||
|
@ -228,4 +230,34 @@ COMMAND cmds[] =
|
||||||
{NULL, 0, NULL}
|
{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 */
|
/* EOF */
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define CMD_VER "0.1"
|
#define CMD_VER "0.1.1"
|
||||||
#define CMD_VER_RC CMD_VER"\0"
|
#define CMD_VER_RC CMD_VER"\0"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $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.
|
* ECHO.C - internal echo commands.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
*
|
*
|
||||||
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
|
||||||
* Unicode and redirection ready!
|
* Unicode and redirection ready!
|
||||||
|
*
|
||||||
|
* 13-Jul-2000 (Eric Kohl <ekohl@rz-online.de>)
|
||||||
|
* Implemented 'echo.' and 'echoerr.'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -39,20 +42,34 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts ("Displays a message or switches command echoing on or off.\n\n"
|
ConOutPuts ("Displays a message or switches command echoing on or off.\n"
|
||||||
"ECHO [ON | OFF]\nECHO [message]\n\n"
|
"\n"
|
||||||
"Type ECHO without a parameter to display the current ECHO setting.");
|
" 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tcsicmp (param, D_OFF) == 0)
|
if (_tcsicmp (cmd, _T("echo.")) == 0)
|
||||||
bEcho = FALSE;
|
{
|
||||||
else if (_tcsicmp (param, D_ON) == 0)
|
if (param[0] == 0)
|
||||||
bEcho = TRUE;
|
ConOutChar (_T('\n'));
|
||||||
else if (*param)
|
else
|
||||||
ConOutPuts (param);
|
ConOutPuts (param);
|
||||||
|
}
|
||||||
else
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +84,7 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
|
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"ECHOS message\n");
|
" ECHOS message");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +105,22 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
ConOutPuts ("Displays a message to the standard error.\n"
|
ConOutPuts ("Displays a message to the standard error.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"ECHOERR message");
|
" ECHOERR message\n"
|
||||||
|
" ECHOERR. prints an empty line");
|
||||||
return 0;
|
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);
|
ConErrPuts (param);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -108,12 +135,12 @@ INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"ECHOSERR message\n");
|
" ECHOSERR message");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*param)
|
if (*param)
|
||||||
ConOutPrintf ("%s", param);
|
ConOutPrintf (_T("%s"), param);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,3 +361,7 @@ o Improved COLOR command.
|
||||||
09-Apr-2000 ReactOS CMD version 0.1 (EricKohl <ekohl@rz-online.de>
|
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.
|
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.
|
||||||
|
|
|
@ -132,9 +132,6 @@
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
|
||||||
extern COMMAND cmds[]; /* The internal command table, used in '?' */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_CHDIR
|
#ifdef INCLUDE_CMD_CHDIR
|
||||||
|
|
||||||
static LPTSTR lpLastPath;
|
static LPTSTR lpLastPath;
|
||||||
|
@ -473,27 +470,7 @@ INT CommandRem (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
INT CommandShowCommands (LPTSTR cmd, LPTSTR param)
|
INT CommandShowCommands (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
LPCOMMAND cmdptr;
|
PrintCommandList ();
|
||||||
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'));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
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
|
The ReactOS command line interpreter CMD is derived from FreeCOM, the
|
||||||
FreeDOS command line interpreter.
|
FreeDOS command line interpreter.
|
||||||
|
@ -13,7 +13,7 @@ Compiling
|
||||||
Cmd can be built in two different versions. A full version for use under
|
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.
|
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.
|
usable under Win 9x/NT.
|
||||||
|
|
||||||
To build the full version, make sure the symbol '__REACTOS__' is NOT defined
|
To build the full version, make sure the symbol '__REACTOS__' is NOT defined
|
||||||
|
@ -25,7 +25,6 @@ in 'rosapps/cmd/config.h' line 13.
|
||||||
|
|
||||||
Current Features
|
Current Features
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- environment handling with prompt and path support.
|
- environment handling with prompt and path support.
|
||||||
- directory utilities.
|
- directory utilities.
|
||||||
- command-line history with doskey-like features.
|
- command-line history with doskey-like features.
|
||||||
|
@ -33,11 +32,11 @@ Current Features
|
||||||
- input/output redirection and piping.
|
- input/output redirection and piping.
|
||||||
- alias support.
|
- alias support.
|
||||||
- filename completion (use TAB)
|
- filename completion (use TAB)
|
||||||
|
(this is still incomplete)
|
||||||
|
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
FreeDOS developers:
|
FreeDOS developers:
|
||||||
normat@rpi.edu (Tim Norman)
|
normat@rpi.edu (Tim Norman)
|
||||||
mrains@apanix.apana.org.au (Matt Rains)
|
mrains@apanix.apana.org.au (Matt Rains)
|
||||||
|
@ -52,15 +51,17 @@ FreeDOS developers:
|
||||||
Hans B Pufal <hansp@digiweb.com>
|
Hans B Pufal <hansp@digiweb.com>
|
||||||
|
|
||||||
ReactOS developers:
|
ReactOS developers:
|
||||||
Eric Kohl <ekohl@abo.rhein-zeitung.de>
|
Eric Kohl <ekohl@rz-online.de>
|
||||||
Emanuele Aliberti <ea@iol.it>
|
Emanuele Aliberti <ea@iol.it>
|
||||||
Paolo Pantaleo <paolopan@freemail.it>
|
Paolo Pantaleo <paolopan@freemail.it>
|
||||||
|
|
||||||
|
|
||||||
Bugs
|
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
|
Good luck
|
||||||
|
|
|
@ -12,4 +12,4 @@ Wishlist for ReactOS CMD
|
||||||
|
|
||||||
More ideas?
|
More ideas?
|
||||||
|
|
||||||
Eric Kohl <ekohl@abo.rhein-zeitung.de>
|
Eric Kohl <ekohl@rz-online.de>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue