Particular DIR commands like: "DIR .", "DIR .." now work as expected,
and we also correctly fix the behavior for files without extension,
that r38746 (2b06cfc0) originally tried to fix but broke the previous
examples.
Therefore "DIR *." and "DIR noextfile." work too.
Pathological cases like "DIR \...", "DIR \...\.", "DIR ..\...\.." and
the like (and with more than 3 dots) now work as expected.
Adapted from PR #592 by Katayama Hirofumi MZ, but with extended bugfixing.
CORE-13961
- Introduce two small helpers to change and restore the console title.
- Console title can change even when internal commands are executed.
- Note that when commands are run from within batch files, title is unchanged.
- When "cmd.exe /c command" is run, the console title is unchanged; however
when "cmd.exe /k command" is run, the console title changes.
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.
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.
CORE-11677
The standard Win32 Console Control Handler will give CTRL-C events to
processes spawned from cmd.exe. If cmd.exe calls GenerateConsolCtrlEvent()
then the child process will receive two CTRL-C events.
- Start to doxygenate the library, focusing in great details on the
functions of the "outstream" module.
- Add a K32LoadStringEx function that expands (K32)LoadString by
allowing a LanguageId parameter to be able to load strings from other
languages than the current one.
- Add "ConResMsg*" helper functions to be able to (format and) print
message strings with inserts that come *NOT* from a message table (as
usual) *BUT* from resource string tables.
Will be helpful for CORE-14265 in particular.
[CMD] Fix the call to ConMsgPrintfV().
The command should delete files in the specified directory and all of its
sub-directories, using any file pattern specified.
For example, the command:
del /S .\my_directory
should delete all the files inside my_directory and its sub-directories,
and as such should also detect that "my_directory" is indeed a directory,
while doing:
del /S .\my_file
should of course detect that "my_file" is indeed a file pattern, and thus,
delete all "my_file" files from the current directory and its sub-directories.
The command:
del /S some_directory\file_pattern
should delete "file_pattern" files from some_directory and its sub-directories.
CORE-10495 CORE-13672
- Fix the behaviour of the EXIT command, where it set the last errorlevel
value ONLY when it was called with the /b switch and otherwise kept the
ambient one, instead of always using the value that the user specified
on the command-line.
- When a batch file has terminated, make the Batch() helper returning the
errorlevel value so that, when the batch file has been started with the
CALL command, CALL can in turn set the correct errorlevel value.
Verified with respect to Windows' cmd.exe.
CORE-13974
This should fix situations where (for example):
command_1 | command_2 && echo Succeeded
should *NOT* run "echo Succeeded" if any of the command_1 or command_2 has
failed.
This also makes the ExecutePipeline() function on par with the other
"ExecuteXXX()" helpers.
Problem diagnosed by Doug Lyons; patch inspired by contributor 'cagey45'.