mirror of
https://github.com/reactos/reactos.git
synced 2024-06-22 22:11:39 +00:00
![]() All these modifications have been verified with Windows' CMD, either by using written cmd_rostests and the existing cmd_winetests, or manually by enabling the flags cmd!fDumpTokens and cmd!fDumpParse (available in the public symbols) and analyzing how the tokens are being parsed, as well as the generated command tree. See also the following links for more details (but remember that these observations have to be double-checked in Windows' CMD!): * Parser rules: https://stackoverflow.com/a/4095133/13530036 * Discussion: https://www.dostips.com/forum/viewtopic.php?f=3&t=8355 * Numbers parsing: https://www.dostips.com/forum/viewtopic.php?t=3758 * Label names vs. GOTO and CALL: https://www.dostips.com/forum/viewtopic.php?f=3&t=3803 and: https://www.dostips.com/forum/viewtopic.php?f=3&t=3803&p=55405#p55405 - Fix REM command parsing. A C_COMMAND-like structure should still be built, so that it can show up during batch command echo. However some specific handling needs to be done, so use instead a new C_REM command type. Escape carets are parsed differently than usual: they are explicitly kept in the command line and don't participate in line continuations. Also, the Windows' CMD behaviour is to discards everything before the last line continuation. - Prefix operator '@' (the "silent" operator) is parsed as a separate command. Thus, the command @@foo@bar is parsed as: '@', '@', 'foo@bar'. - Improve the checks for numbered redirection. For this purpose, we check whether this is a number, that is in first position in the current parsing buffer or is preceded by a whitespace- like separator, including standard command operators (excepting '@' !) and double-quotes. - Empty command blocks, i.e. "( )", standing by themselves, or present in IF or FOR commands, are considered invalid. (The closing parenthesis is considered "unexpected".) - Ignore single closing parenthesis when being outside of command blocks, thus interpreting it as a command, and ignore explicitly everything following on the same line, including line continuations. This very specific situation can happen e.g. while running in batch mode, when jumping to a label present inside a command block. See the code for a thorough explanation. - Detect whether a parenthesized block is not terminated at the end of a command stream (getting a NUL character instead of a newline), and if so, bail out early instead of entering into an infinite loop. - Perform a similar check for the parenthesized list in FOR commands. - Initialize the static 'InsideBlock' value to a known value. - The '&' operator (multi-commmand) is allowed to have an empty RHS. When such situation occurs, turn the CurrentTokenType to TOK_END so as to avoid a parse error later on. - The main body of a IF statement, or its 'else' clause, as well as the main body of a FOR statement, must not be empty, otherwise this is considered a syntax error. If so, call ParseError() that sets the 'bParseError' flag, and forcing all batch execution to stop. |
||
---|---|---|
.. | ||
lang | ||
res | ||
alias.c | ||
assoc.c | ||
batch.c | ||
batch.h | ||
beep.c | ||
call.c | ||
choice.c | ||
cls.c | ||
CMakeLists.txt | ||
cmd.c | ||
cmd.h | ||
cmd.rc | ||
cmddbg.c | ||
cmddbg.h | ||
cmdinput.c | ||
cmdtable.c | ||
cmdver.h | ||
color.c | ||
config.h | ||
console.c | ||
console.h | ||
copy.c | ||
ctty.c | ||
date.c | ||
del.c | ||
delay.c | ||
dir.c | ||
dirstack.c | ||
echo.c | ||
error.c | ||
filecomp.c | ||
files.txt | ||
for.c | ||
free.c | ||
goto.c | ||
history.c | ||
history.txt | ||
if.c | ||
internal.c | ||
license.txt | ||
locale.c | ||
memory.c | ||
misc.c | ||
mklink.c | ||
move.c | ||
msgbox.c | ||
parser.c | ||
path.c | ||
pause.c | ||
precomp.h | ||
prompt.c | ||
readme.txt | ||
readme2.txt | ||
redir.c | ||
ren.c | ||
ren.txt | ||
replace.c | ||
resource.h | ||
screen.c | ||
set.c | ||
setlocal.c | ||
shift.c | ||
start.c | ||
strtoclr.c | ||
time.c | ||
timer.c | ||
title.c | ||
todo.txt | ||
type.c | ||
ver.c | ||
verify.c | ||
vol.c | ||
where.c | ||
window.c |
ReactOS command line interpreter CMD ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ReactOS command line interpreter CMD is derived from FreeCOM, the FreeDOS command line interpreter. We are shooting mainly to be just like 2000/XP cmd.exe. They are very close and only a small number(none that i can recall off the top of my head, so maybe 0) differences have been found between those two. It has been reported that ROS cmd.exe does not work on nt4 because of a missing api. I'm hoping to fix this at some point. Compiling ~~~~~~~~~ ROS cmd used to depend on __REACTOS__ to provide two different ways to build cmd. There is still code left in it for this but... The __REACTOS__ = 0 has not been develped, maintained. And therefore it does not even compile anymore. __REACTOS__ = 1 works fine on both windows(nt). and someday i plan to remove all the __REACTOS__ = 0. Using rbuild you can compile cmd separately by "make cmd_install". Also you can compile cmd using MSVC 6 and soon 7/8 hopefully. Current Features ~~~~~~~~~~~~~~~~ - environment handling with prompt and path support. - directory utilities. - command-line history with doskey-like features. - batch file processing. - input/output redirection and piping. - alias support. - filename completion (use TAB), both Bash and Windows-CMD style. Credits ~~~~~~~ FreeDOS developers: normat@rpi.edu (Tim Norman) mrains@apanix.apana.org.au (Matt Rains) ejeffrey@iastate.edu (Evan Jeffrey) Steffen.Kaiser@Informatik.TU-Chemnitz.DE (Steffen Kaiser) Svante Frey (sfrey@kuai.se) Oliver Mueller (ogmueller@t-online.de) Aaron Kaufman (morgan@remarque.berkeley.edu) Marc Desrochers (bitzero@hotmail.com) Rob Lake (rlake@cs.mun.ca) John P. Price <linux-guru@gcfl.net> Hans B Pufal <hansp@digiweb.com> ReactOS developers: Eric Kohl Emanuele Aliberti <ea@iol.it> Paolo Pantaleo <paolopan@freemail.it> Brandon Turner <turnerb7@msu.edu> Bugs ~~~~ There are still many bugs ;) Please report bugs to ReactOS team <ros-dev@reactos.org> or to JIRA at www.reactos.org