mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 14:53:09 +00:00
[CMD]
Fix whitespace (part 3/x) (convert tabs into 4-space indent). svn path=/trunk/; revision=59379
This commit is contained in:
parent
9b6dc5bd15
commit
6437619ff3
25 changed files with 3026 additions and 3010 deletions
|
@ -25,8 +25,8 @@
|
||||||
* 24-Jan-1998 Eric Kohl
|
* 24-Jan-1998 Eric Kohl
|
||||||
* Redirection safe!
|
* Redirection safe!
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*
|
*
|
||||||
* 02-Feb-2008 (Christoph von Wittich) <christoph_vw@reactos.org>)
|
* 02-Feb-2008 (Christoph von Wittich) <christoph_vw@reactos.org>)
|
||||||
* rewrote alias handling for doskey compat
|
* rewrote alias handling for doskey compat
|
||||||
|
|
|
@ -205,7 +205,6 @@ RemoveAssociation(LPTSTR extension)
|
||||||
|
|
||||||
INT CommandAssoc (LPTSTR param)
|
INT CommandAssoc (LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* print help */
|
/* print help */
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
* 23-Jan-1999 Eric Kohl
|
* 23-Jan-1999 Eric Kohl
|
||||||
* Added handling of multiple filenames.
|
* Added handling of multiple filenames.
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
* 20-Jan-1999 (Eric Kohl)
|
* 20-Jan-1999 (Eric Kohl)
|
||||||
* Redirection ready!
|
* Redirection ready!
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 20-Jan-1999 (Eric Kohl)
|
* 20-Jan-1999 (Eric Kohl)
|
||||||
* Unicode and redirection safe!
|
* Unicode and redirection safe!
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* 23-Dec-1998 (Eric Kohl)
|
* 23-Dec-1998 (Eric Kohl)
|
||||||
* Started.
|
* Started.
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -13,9 +13,8 @@
|
||||||
* 26 Sep 1999 (Paolo Pantaleo)
|
* 26 Sep 1999 (Paolo Pantaleo)
|
||||||
* Fixed timeout.
|
* Fixed timeout.
|
||||||
*
|
*
|
||||||
* 02 Apr 2005 (Magnus Olsen
|
* 02 Apr 2005 (Magnus Olsen)
|
||||||
* Remove Hardcode string so
|
* Remove hardcoded strings so that they can be translated.
|
||||||
* they can be translate
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
* 20-Jan-1998 (Eric Kohl)
|
* 20-Jan-1998 (Eric Kohl)
|
||||||
* Redirection ready!
|
* Redirection ready!
|
||||||
*
|
*
|
||||||
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
/* a list of all the internal commands, associating their command names */
|
/*
|
||||||
/* to the functions to process them */
|
* A list of all the internal commands, associating their command names
|
||||||
|
* to the functions to process them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
COMMAND cmds[] =
|
COMMAND cmds[] =
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* 14-Oct-1999 (Paolo Pantaleo <paolopan@freemail.it>)
|
* 14-Oct-1999 (Paolo Pantaleo <paolopan@freemail.it>)
|
||||||
* 4nt's syntax implemented.
|
* 4nt's syntax implemented.
|
||||||
*
|
*
|
||||||
* 03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 03-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Move all hardcoded strings to En.rc.
|
* Move all hardcoded strings in En.rc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
* 13-Jul-2000 (Eric Kohl)
|
* 13-Jul-2000 (Eric Kohl)
|
||||||
* Implemented 'echo.' and 'echoerr.'.
|
* Implemented 'echo.' and 'echoerr.'.
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* 02-Feb-1999 (Eric Kohl)
|
* 02-Feb-1999 (Eric Kohl)
|
||||||
* Use FormatMessage() for error reports.
|
* Use FormatMessage() for error reports.
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
* Implemented preservation of echo flag. Some other for related
|
* Implemented preservation of echo flag. Some other for related
|
||||||
* code in other files fixed, too.
|
* code in other files fixed, too.
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* 01-Sep-1999 (Eric Kohl)
|
* 01-Sep-1999 (Eric Kohl)
|
||||||
* Started.
|
* Started.
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
@ -79,7 +79,6 @@ PrintDiskInfo (LPTSTR szDisk)
|
||||||
uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwFreeCl;
|
uliSize = dwSecPerCl * dwBytPerSec * (ULONGLONG)dwFreeCl;
|
||||||
ConvertULargeInteger(uliSize, szFree, 40, TRUE);
|
ConvertULargeInteger(uliSize, szFree, 40, TRUE);
|
||||||
|
|
||||||
|
|
||||||
ConOutResPrintf(STRING_FREE_HELP1, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
|
ConOutResPrintf(STRING_FREE_HELP1, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
* 27-Jan-1999 (Eric Kohl)
|
* 27-Jan-1999 (Eric Kohl)
|
||||||
* Added help text ("/?").
|
* Added help text ("/?").
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
* 17-Feb-2001 (ea)
|
* 17-Feb-2001 (ea)
|
||||||
* IF DEFINED variable command
|
* IF DEFINED variable command
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* 19-Jan-1998 (Eric Kohl)
|
* 19-Jan-1998 (Eric Kohl)
|
||||||
* Unicode ready!
|
* Unicode ready!
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* 01-Sep-1999 (Eric Kohl)
|
* 01-Sep-1999 (Eric Kohl)
|
||||||
* Started.
|
* Started.
|
||||||
*
|
*
|
||||||
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* 25 Aug 1999
|
* 25 Aug 1999
|
||||||
* started - Paolo Pantaleo <paolopan@freemail.it>
|
* started - Paolo Pantaleo <paolopan@freemail.it>
|
||||||
*
|
*
|
||||||
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
INT CommandMsgbox (LPTSTR param)
|
INT CommandMsgbox (LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
//used to parse command line
|
//used to parse command line
|
||||||
LPTSTR tmp;
|
LPTSTR tmp;
|
||||||
|
|
||||||
|
@ -84,7 +83,6 @@ INT CommandMsgbox (LPTSTR param)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//skip spaces
|
//skip spaces
|
||||||
while(_istspace(*param))
|
while(_istspace(*param))
|
||||||
param++;
|
param++;
|
||||||
|
|
|
@ -11,7 +11,8 @@ static const TCHAR OpString[][3] = { _T("&"), _T("||"), _T("&&"), _T("|") };
|
||||||
|
|
||||||
static const TCHAR RedirString[][3] = { _T("<"), _T(">"), _T(">>") };
|
static const TCHAR RedirString[][3] = { _T("<"), _T(">"), _T(">>") };
|
||||||
|
|
||||||
static const TCHAR *const IfOperatorString[] = {
|
static const TCHAR *const IfOperatorString[] =
|
||||||
|
{
|
||||||
_T("cmdextversion"),
|
_T("cmdextversion"),
|
||||||
_T("defined"),
|
_T("defined"),
|
||||||
_T("errorlevel"),
|
_T("errorlevel"),
|
||||||
|
@ -35,8 +36,15 @@ static BOOL IsSeparator(TCHAR Char)
|
||||||
return _istspace(Char) || (Char && _tcschr(STANDARD_SEPS, Char));
|
return _istspace(Char) || (Char && _tcschr(STANDARD_SEPS, Char));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { TOK_END, TOK_NORMAL, TOK_OPERATOR, TOK_REDIRECTION,
|
enum
|
||||||
TOK_BEGIN_BLOCK, TOK_END_BLOCK };
|
{
|
||||||
|
TOK_END,
|
||||||
|
TOK_NORMAL,
|
||||||
|
TOK_OPERATOR,
|
||||||
|
TOK_REDIRECTION,
|
||||||
|
TOK_BEGIN_BLOCK,
|
||||||
|
TOK_END_BLOCK
|
||||||
|
};
|
||||||
|
|
||||||
static BOOL bParseError;
|
static BOOL bParseError;
|
||||||
static BOOL bLineContinuations;
|
static BOOL bLineContinuations;
|
||||||
|
@ -56,9 +64,11 @@ static TCHAR ParseChar()
|
||||||
return CurChar = 0;
|
return CurChar = 0;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
/* Although CRs can be injected into a line via an environment
|
/*
|
||||||
|
* Although CRs can be injected into a line via an environment
|
||||||
* variable substitution, the parser ignores them - they won't
|
* variable substitution, the parser ignores them - they won't
|
||||||
* even separate tokens. */
|
* even separate tokens.
|
||||||
|
*/
|
||||||
do
|
do
|
||||||
Char = *ParsePos++;
|
Char = *ParsePos++;
|
||||||
while (Char == _T('\r'));
|
while (Char == _T('\r'));
|
||||||
|
@ -88,8 +98,10 @@ static void ParseError()
|
||||||
bParseError = TRUE;
|
bParseError = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Yes, cmd has a Lexical Analyzer. Whenever the parser gives an "xxx was
|
/*
|
||||||
* unexpected at this time." message, it shows what the last token read was */
|
* Yes, cmd has a Lexical Analyzer. Whenever the parser gives an "xxx was
|
||||||
|
* unexpected at this time." message, it shows what the last token read was.
|
||||||
|
*/
|
||||||
static int ParseToken(TCHAR ExtraEnd, TCHAR *Separators)
|
static int ParseToken(TCHAR ExtraEnd, TCHAR *Separators)
|
||||||
{
|
{
|
||||||
TCHAR *Out = CurrentToken;
|
TCHAR *Out = CurrentToken;
|
||||||
|
@ -266,6 +278,7 @@ static BOOL ParseRedirection(REDIRECTION **List)
|
||||||
_tcscpy(Redir->Filename, Tok);
|
_tcscpy(Redir->Filename, Tok);
|
||||||
*List = Redir;
|
*List = Redir;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
ParseError();
|
ParseError();
|
||||||
FreeRedirection(*List);
|
FreeRedirection(*List);
|
||||||
|
@ -411,8 +424,10 @@ condition_done:
|
||||||
return Cmd;
|
return Cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse a FOR command.
|
/*
|
||||||
* Syntax is: FOR [options] %var IN (list) DO command */
|
* Parse a FOR command.
|
||||||
|
* Syntax is: FOR [options] %var IN (list) DO command
|
||||||
|
*/
|
||||||
static PARSED_COMMAND *ParseFor(void)
|
static PARSED_COMMAND *ParseFor(void)
|
||||||
{
|
{
|
||||||
PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
|
PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
|
||||||
|
@ -730,8 +745,10 @@ ParseCommand(LPTSTR Line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Reconstruct a parse tree into text form; used for echoing
|
/*
|
||||||
* batch file commands and FOR instances. */
|
* Reconstruct a parse tree into text form; used for echoing
|
||||||
|
* batch file commands and FOR instances.
|
||||||
|
*/
|
||||||
VOID
|
VOID
|
||||||
EchoCommand(PARSED_COMMAND *Cmd)
|
EchoCommand(PARSED_COMMAND *Cmd)
|
||||||
{
|
{
|
||||||
|
@ -819,9 +836,11 @@ EchoCommand(PARSED_COMMAND *Cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Unparse" a command into a text form suitable for passing to CMD /C.
|
/*
|
||||||
|
* "Unparse" a command into a text form suitable for passing to CMD /C.
|
||||||
* Used for pipes. This is basically the same thing as EchoCommand, but
|
* Used for pipes. This is basically the same thing as EchoCommand, but
|
||||||
* writing into a string instead of to standard output. */
|
* writing into a string instead of to standard output.
|
||||||
|
*/
|
||||||
TCHAR *
|
TCHAR *
|
||||||
Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd)
|
Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd)
|
||||||
{
|
{
|
||||||
|
@ -829,9 +848,11 @@ Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd)
|
||||||
PARSED_COMMAND *Sub;
|
PARSED_COMMAND *Sub;
|
||||||
REDIRECTION *Redir;
|
REDIRECTION *Redir;
|
||||||
|
|
||||||
/* Since this function has the annoying requirement that it must avoid
|
/*
|
||||||
|
* Since this function has the annoying requirement that it must avoid
|
||||||
* overflowing the supplied buffer, define some helper macros to make
|
* overflowing the supplied buffer, define some helper macros to make
|
||||||
* this less painful */
|
* this less painful.
|
||||||
|
*/
|
||||||
#define CHAR(Char) { \
|
#define CHAR(Char) { \
|
||||||
if (Out == OutEnd) return NULL; \
|
if (Out == OutEnd) return NULL; \
|
||||||
*Out++ = Char; }
|
*Out++ = Char; }
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
* 24-Jan-1999 (Eric Kohl)
|
* 24-Jan-1999 (Eric Kohl)
|
||||||
* Fixed Win32 environment handling.
|
* Fixed Win32 environment handling.
|
||||||
*
|
*
|
||||||
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
INT cmd_path (LPTSTR param)
|
INT cmd_path (LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutResPaging(TRUE,STRING_PATH_HELP1);
|
ConOutResPaging(TRUE,STRING_PATH_HELP1);
|
||||||
|
|
|
@ -30,13 +30,12 @@
|
||||||
* ?? Extend to include functionality of CHOICE if switch chars
|
* ?? Extend to include functionality of CHOICE if switch chars
|
||||||
* specified.
|
* specified.
|
||||||
*
|
*
|
||||||
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
|
* 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>
|
||||||
* Remove all hardcode string to En.rc
|
* Remove all hardcoded strings in En.rc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
INT cmd_pause (LPTSTR param)
|
INT cmd_pause (LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
TRACE ("cmd_pause: \'%s\')\n", debugstr_aw(param));
|
TRACE ("cmd_pause: \'%s\')\n", debugstr_aw(param));
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue