#
075894bc |
| 16-Jul-2024 |
Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> |
[CMD] Fix GetPathCase function (#7113)
This GetPathCase function does
resolve the path with wildcard
pattern, and fix the alphabet
cases, by using
kernel32!FindFirstFile function.
Enable wildca
[CMD] Fix GetPathCase function (#7113)
This GetPathCase function does
resolve the path with wildcard
pattern, and fix the alphabet
cases, by using
kernel32!FindFirstFile function.
Enable wildcard at the middle
of the file path in cmd.exe by
fixing this function.
JIRA issue: CORE-6609
JIRA issue: CORE-13906
- Fix GetPathCase function for
supporting wildcard at the
- middle of the file path.
- Make GetPathCase string-safe.
- Optimize GetPathCase.
show more ...
|
#
190b3da9 |
| 09-May-2024 |
Carl J. Bialorucki <cbialo2@outlook.com> |
[CMD][BOOTDATA] Minor improvements (#5745)
* Remove a hardcoded copyright string and move into localizable resources.
* Remove the PROMPT environment variable from clean installs of ReactOS. By def
[CMD][BOOTDATA] Minor improvements (#5745)
* Remove a hardcoded copyright string and move into localizable resources.
* Remove the PROMPT environment variable from clean installs of ReactOS. By default, the command prompt uses $P$G (path + '>') as its prompt settings and does not require this environment variable. Clean installs of Windows Server 2003 do not include this environment variable either. I documented this environment variable in our wiki if anyone would like to set it on their own ReactOS installs.
* Remove the new line above the copyright notice when the information line is turned off.
CORE-16193, CORE-17031
show more ...
|
Revision tags: 0.4.14-release |
|
#
37bda06e |
| 26-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] CALL: Fix the implementation of the CALL command, make it more compatible with Windows' CMD.
- Fail if no parameter is provided.
- The "CALL :label args..." syntax is available only when comm
[CMD] CALL: Fix the implementation of the CALL command, make it more compatible with Windows' CMD.
- Fail if no parameter is provided.
- The "CALL :label args..." syntax is available only when command extensions are enabled. Fail if this syntax is used outside of a batch context.
- Reparse the CALL command parameter with the command parser, in order to accurately parse and interpret it as a possible command (including escape carets, etc...) and not duplicate the logic. ** CURRENT Windows' CMD-compatibility LIMITATION ** (may be lifted in a "ROS-specific" running mode of CMD): only allow standard commands to be specified as parameter of the CALL command.
This reparsing behaviour can be observed in Windows' CMD, by dumping the interpreted commands after enabling the cmd!fDumpParse flag from a debugger (using public symbols).
- When reparsing, we should tell the parser to NOT ignore lines that start with a colon, because in this situation these are to be considered as valid "commands" (for parsing "CALL :label").
* For Windows' CMD-compatibility, the remaining escape carets need to be doubled again so that, after the new parser step, they are escaped back to their original form. But then we also need to do it the "buggy" way à la Windows, where carets in quotes are doubled either! However when being re-parsed, since they are in quotes they remain doubled!! (see "Phase 6" in https://stackoverflow.com/a/4095133/13530036 ).
* A MSCMD_CALL_QUIRKS define allows to disable this buggy behaviour, and instead tell the parser to not not interpret the escape carets.
- When initializing a new batch context when the "CALL :label" syntax is used, ensure that we reuse the same batch file position pointer as its parent, so as to have correct call label ordering behaviour.
That is,
:label ECHO hi CALL :label :label ECHO bye
should display:
hi bye bye
i.e., the CALL calls the second label instead of the first one (and thus entering into an infinite loop).
Finally, the "CALL :label" syntax strips the first ':' away, so, as a side-effect, the command "CALL :EOF" fails (otherwise it would perform a "GOTO :EOF" and succeeds), while "CALL ::EOF" succeeds.
Fixes some cmd_winetests.
show more ...
|
#
d029a626 |
| 22-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Make the command-line parser more compatible with Windows' CMD one.
All these modifications have been verified with Windows' CMD, either by using written cmd_rostests and the existing cmd_wine
[CMD] Make the command-line parser more compatible with Windows' CMD one.
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.
show more ...
|
#
cdc8e45b |
| 04-Jun-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fix delayed expansion of variables. CORE-13682
- Split SubstituteVars() into its main loop and a helper SubstituteVar() that just substitutes only one variable.
- Use this new helper as the
[CMD] Fix delayed expansion of variables. CORE-13682
- Split SubstituteVars() into its main loop and a helper SubstituteVar() that just substitutes only one variable.
- Use this new helper as the basis of the proper implementation of the delayed expansion of variables.
- Fix a bug introduced in commit 495c82cc, when GetBatchVar() fails.
show more ...
|
#
cb2a9c31 |
| 04-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Some fixes for getting the enhanced '%~XXX' batch/FOR variables. CORE-11857 CORE-13736
It will be followed with a separate fix for the FOR-loop code. Fixes some cmd_winetests.
A NULL pointer
[CMD] Some fixes for getting the enhanced '%~XXX' batch/FOR variables. CORE-11857 CORE-13736
It will be followed with a separate fix for the FOR-loop code. Fixes some cmd_winetests.
A NULL pointer can be returned for a valid existing batch/FOR variable, in which case the enhanced-variable getter should return an empty string. This situation can happen e.g. when forcing a FOR-loop to tokenize a text line with not enough tokens in it.
show more ...
|
#
00ce3c48 |
| 12-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Use pointers to const strings in error functions, where applicable.
|
#
3f8f3a2b |
| 12-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Minor formatting only.
|
#
050df0f5 |
| 03-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Code formatting for IsValidPathName, IsExistingFile, IsExistingDirectory, and use INVALID_FILE_ATTRIBUTES instead of an hardcoded value.
|
#
6a8754c8 |
| 24-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] TYPE: Rewrite the command so as to fix some of its behaviour.
- Display the names of the files being TYPEd only if more than one file has been specified on the command-line, or if a file spe
[CMD] TYPE: Rewrite the command so as to fix some of its behaviour.
- Display the names of the files being TYPEd only if more than one file has been specified on the command-line, or if a file specification (with wildcards) is present (even just for one). These names are displayed on STDERR while the files are TYPEd on STDOUT, therefore allowing concatenating files by just redirecting STDOUT to a destination, without corrupting it with the displayed file names. Also, add a /N option to force not displaying these file names.
- When file specifications (with wildcards) are being processed, silently ignore any directories matching them. If no corresponding files have been found, display a file-not-found error.
- When explicitly directory names are specified, don't do any special treatment; the CreateFile() call will fail and return the appropriate error.
- Fix the returned errorlevel values.
See https://ss64.com/nt/type.html for more information.
Fixes some cmd_winetests.
- When reading from a file, retrieve its original size so that we can stop reading it once we are beyond its original ending. This allows avoiding an infinite read loop in case the output of the file is redirected back to it.
Fixes CORE-17208
- Move the FileGetString() helper to the only file where it is actually used.
show more ...
|
#
fedc68ae |
| 12-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] IF: Some functionality is available only when extensions are enabled.
This functionality is: case insensitivity comparisons (/I); CMDEXTVERSION and DEFINED unary operators; EQU, NEQ, LSS, LEQ,
[CMD] IF: Some functionality is available only when extensions are enabled.
This functionality is: case insensitivity comparisons (/I); CMDEXTVERSION and DEFINED unary operators; EQU, NEQ, LSS, LEQ, GTR, GEQ generic string comparators.
show more ...
|
#
47d7de4b |
| 18-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Simplify GetRootPath() and mark its InPath parameter pointer to const string.
|
#
2e4c8c01 |
| 21-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] GOTO: Fix label parsing.
We note two things, when CMD searches for the corresponding label in the batch file: - the first character of the line is always ignored, unless it's a colon; - the es
[CMD] GOTO: Fix label parsing.
We note two things, when CMD searches for the corresponding label in the batch file: - the first character of the line is always ignored, unless it's a colon; - the escape caret ^ is supported and interpreted.
Fixes some cmd_winetests.
show more ...
|
#
6eb1cae3 |
| 18-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fixes for Batch error execution control flow. CORE-13713 CORE-13736
- In case execution of all batch contexts is stopped (by selecting "All" at the Ctrl-C/Ctrl-Break prompt), notify as well
[CMD] Fixes for Batch error execution control flow. CORE-13713 CORE-13736
- In case execution of all batch contexts is stopped (by selecting "All" at the Ctrl-C/Ctrl-Break prompt), notify as well the CheckCtrlBreak() signal handler once there are no more batch contexts (this in effect resets the internal 'bLeaveAll' static flag in CheckCtrlBreak). This is an adaptation of the fix present in FreeCOM 1.5, first described in https://gcfl.net/FreeDOS/command.com/bugs074g.html .
- Introduce a ParseErrorEx() helper that sets the 'bParseError' flag and displays a customized syntax-error message, only for the first syntax error encountered. Implement ParseError() around the *Ex function.
- In batch mode, echo the original pre-parsed batch file line if a parse error has been encountered.
- When running a compound command - including IF, FOR, command blocks -, and that control flow is modified by any CALL/GOTO/EXIT command, detect this while running the compound command so as to stop it and go back to the main batch execution loop, that will then set up the actual new command to run.
- In GOTO, do not process any more parts of a compound command only when we have found a valid label.
show more ...
|
#
ca912d7b |
| 26-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Further code style and formatting fixes.
|
#
04eef6d2 |
| 26-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] parser.c, cmd.c/h : Code style and formatting fixes.
- Change C_IFFAILURE, C_IFSUCCESS into C_OR, C_AND respectively.
|
#
240f6737 |
| 18-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Add a ExecuteCommandWithEcho() helper and use it in Batch() and as the implementation of RunInstance() FOR-loop helper.
|
#
d0ced4ff |
| 17-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fix the ErrorMessage() function.
Specify its szFormat parameter optional, and correctly initialize the szMessage buffer.
|
Revision tags: 0.4.15-dev, 0.4.14-RC, 0.4.13-release, 0.4.14-dev, 0.4.13-RC |
|
#
6bfe4f68 |
| 22-Sep-2019 |
Eric Kohl <eric.kohl@reactos.org> |
[LABEL][CMD] Convert the label command to a standalone executable
CORE-9444
|
#
432854ee |
| 21-Sep-2019 |
Eric Kohl <eric.kohl@reactos.org> |
[ATTRIB][CMD] Convert the 'attrib' command into a standalone executable
CORE-9444
|
Revision tags: 0.4.12-release, 0.4.12-RC, 0.4.13-dev, 0.4.11-release, 0.4.11-RC, 0.4.12-dev, 0.4.10-release, 0.4.11-dev, 0.4.10-RC, 0.4.9-release, 0.4.10-dev, 0.4.9-RC, 0.4.8-release, 0.4.8-RC, 0.4.9-dev |
|
#
3f892a8d |
| 03-Dec-2017 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Add missing memory allocation NULL checks (#161). CORE-8304
Adapted from a patch by Jacob S. Preciado.
Bring also the code suggestions emitted during review.
|
#
a3b36f8d |
| 28-Apr-2018 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Don't reset bCtrlBreak too early.
This allows to break commands such as:
C:\ReactOS\system32> for %f in (*.*) do dir
as one would expect: stop the currently running 'dir' and the 'for'. "bCt
[CMD] Don't reset bCtrlBreak too early.
This allows to break commands such as:
C:\ReactOS\system32> for %f in (*.*) do dir
as one would expect: stop the currently running 'dir' and the 'for'. "bCtrlBreak" doesn't need to be volatile too.
show more ...
|
#
d7e71357 |
| 27-Apr-2018 |
James Woodcock <james_woodcock@yahoo.co.uk> |
[CMD] Fix CTRL-C handling.
Using CTRL-C to cancel command line input would leave the prompt in a state where the next command would be ignored. For example:
dir<CTRL-C> dir
would cause cmd.exe to
[CMD] Fix CTRL-C handling.
Using CTRL-C to cancel command line input would leave the prompt in a state where the next command would be ignored. For example:
dir<CTRL-C> dir
would cause cmd.exe to ignore the second dir command.
show more ...
|
Revision tags: 0.4.7-release, v0.4.7, 0.4.8-dev, 0.4.7-rc1 |
|
#
c2c66aff |
| 03-Oct-2017 |
Colin Finck <colin@reactos.org> |
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
|
Revision tags: backups/GSoC_2017/rapps@75905, ReactOS-0.4.6, backups/ros-branch-0_4_6@75728, 0.4.7-dev, ReactOS-0.4.5, backups/ros-branch-0_4_5@74569, ReactOS-0.4.4-CLT2017, backups/ReactOS-0.4.4-CLT2017@74182, ReactOS-0.4.4, backups/ros-branch-0_4_4@74002, ReactOS-0.4.4-FOSDEM2017, backups/ReactOS-0.4.4-FOSDEM2017@73667, ReactOS-0.4.3, backups/ros-branch-0_4_3@73437, backups/sndblst@72664, ReactOS-0.4.2, backups/ros-branch-0_4_2@73087, ReactOS-0.4.1, backups/ros-branch-0_4_1@71718 |
|
#
321bcc05 |
| 24-Apr-2016 |
Pierre Schweitzer <pierre@reactos.org> |
Create the AHCI branch for Aman's work
svn path=/branches/GSoC_2016/AHCI/; revision=71203
|