Commit graph

157 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto 3f8f3a2bba
[CMD] Minor formatting only. 2020-09-13 22:50:09 +02:00
Hermès Bélusca-Maïto 050df0f56d
[CMD] Code formatting for IsValidPathName, IsExistingFile, IsExistingDirectory, and use INVALID_FILE_ATTRIBUTES instead of an hardcoded value. 2020-09-04 00:24:45 +02:00
Hermès Bélusca-Maïto c81bf4f823
[CMD] IF: Add extra validity checks in ExecuteIf(). 2020-09-03 16:05:55 +02:00
Catalin Gabriel Draghita 0ab63f9590
[BASE] Improve Spanish (es-ES) translation (#3088) 2020-08-25 18:10:23 +03:00
Adam Stachowicz ca68686a98
[CMD] Update Polish (pl-PL) translation (#3082)
Addendum to 7c175d4.
2020-08-20 12:25:52 +03:00
Stanislav Motylkov fa120ac0cd
[CMD] Update Russian (ru-RU) translation
Addendum to 7c175d4.
2020-08-20 02:04:17 +03:00
Hermès Bélusca-Maïto 6925ca37ab
[CMD] Add mention of the /Y switch in MORE command help; re-position the STRING_PAUSE_HELP1 string. 2020-08-19 21:39:23 +02:00
Hermès Bélusca-Maïto 6a8754c83a
[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.
2020-08-19 21:39:22 +02:00
Hermès Bélusca-Maïto 3d4af22328
[CMD] CHDIR: Some features are available only when extensions are enabled. Update the SetRootPath() as well. 2020-08-19 21:39:21 +02:00
Hermès Bélusca-Maïto fe9aa42d5f
[CMD] SET: Fix displaying the environment variables with a given prefix.
- Restore any truncated space in the name prefix, before displaying
  any error message.

- When trimming the name prefix from "special" characters (spaces, comma
  and semicolon), so that e.g. "set ,; ,;FOO" displays all the variables
  starting by "FOO", save also a pointer to the original name prefix, that
  we will use for variables lookup as well.

  This is done, because the SET command allows setting an environment variable
  whose name actually contains these characters (e.g. "set ,; ,;FOO=42"),
  however, by trimming the characters, doing "set ,; ,;FOO" would not allow
  seeing such variables.
  With the fix, it is now possible to show them.
2020-08-19 21:39:18 +02:00
Hermès Bélusca-Maïto 8cea82b14c
[CMD] REPLACE: Fix a memory leak. 2020-08-19 20:36:13 +02:00
Hermès Bélusca-Maïto 1cb7e08522
[CMD] SETLOCAL / ENDLOCAL: Save / Restore as well the current drive and current directory.
That's an actual fact, done on original MS-DOS COMMAND.COM, FreeCOM,
Windows' CMD.EXE, etc., but is strangely undocumented on MSDN documentation.

See https://www.dostips.com/forum/viewtopic.php?t=4436

Fixes some cmd_winetests.
2020-08-19 20:36:13 +02:00
Hermès Bélusca-Maïto e8e31267c5
[CMD] setlocal.c : Code style and formatting fixes 2020-08-19 20:36:13 +02:00
Hermès Bélusca-Maïto 90159e1e51
[CMD] Implement provisional support for the HIGHESTNUMANODENUMBER environment-like variable.
This variable is available only in Win7+, even if the underlying API
GetNumaHighestNodeNumber() is available in Win2003+
2020-08-19 20:36:12 +02:00
Hermès Bélusca-Maïto 04e0fe0652
[CMD] The "special" environment-like variables are available only when extensions are enabled.
The "special" variables are: CD, DATE, TIME, RANDOM,
CMDCMDLINE, CMDEXTVERSION, ERRORLEVEL (and on Win7+,
HIGHESTNUMANODENUMBER).
2020-08-19 20:36:12 +02:00
Hermès Bélusca-Maïto 41a93a4e58
[CMD] FOR: Some functionality is available only when extensions are enabled.
This is basically all the advanced functionality enabled with the /D,
/R, /L and /F flags, and the usage of enhanced variables.
2020-08-19 20:36:11 +02:00
Hermès Bélusca-Maïto fedc68aea8
[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.
2020-08-19 20:36:11 +02:00
Hermès Bélusca-Maïto 80844dc185
[CMD] DATE: Simplify the input loop, based on the TIME command.
Set also the ERRORLEVEL in case of error.
2020-08-19 20:36:10 +02:00
Hermès Bélusca-Maïto a151893351
[CMD] DATE: The /T option is available only when extensions are enabled. 2020-08-19 20:36:10 +02:00
Hermès Bélusca-Maïto 682875d070
[CMD] TIME: The /T option is available only when extensions are enabled.
And merge two string buffers into one.
2020-08-19 20:36:09 +02:00
Hermès Bélusca-Maïto aab632644f
[CMD] Some code style and formatting fixes 2020-08-19 20:36:09 +02:00
Hermès Bélusca-Maïto 47d7de4b7b
[CMD] Simplify GetRootPath() and mark its InPath parameter pointer to const string. 2020-08-19 20:36:08 +02:00
Hermès Bélusca-Maïto f43ee81573
[CMD] CHDIR: Adjust ERROR_FILE_NOT_FOUND into ERROR_PATH_NOT_FOUND if _tchdir() fails. 2020-08-19 20:36:08 +02:00
Hermès Bélusca-Maïto 9871becced
[CMD] It is not the job of ErrorMessage() to set the errorlevel! It is set only by the commands that want it. 2020-08-19 20:36:08 +02:00
Hermès Bélusca-Maïto 3b960a1c21
[CMD] MOVE: Set the errorlevel on failure.
CORE-14261
2020-08-19 20:36:07 +02:00
Hermès Bélusca-Maïto ae649656db
[CMD] RMDIR: Improve some aspects of the /S option.
- First, the option and the APIs called by it can work directly on
  paths relative to the current directory. So there is no need to
  call GetFullPathName(), with the risk of going over MAX_PATH if the
  current path is quite long (or nested) but the RMDIR is called on a
  (short-length) relative sub-directory.

- Append a path-separator (backslash), only if the specified directory
  does not have one already, and, that it does not specify a current
  directory via the "drive-root" method, e.g. "C:" without any trailing
  backslash.

- In case there are errors during deletion of sub-directories or
  sub-files, print the error but continue deleting the other sub-dirs
  or files.

- Monitor the Ctrl-C breaker as well, and stop deleting if it has been
  triggered.

- When removing file/directory read-only attribute, just remove this
  attribute, but keep the other ones.

- When deleting the directory, first try to do it directly; if it fails
  with access denied, check whether it was read-only, and if so, remove
  this attribute and retry deletion, otherwise fails.

- When recursively deleting a drive root directory, ultimately resolve
  the dir pattern and check whether it's indeed a drive root, e.g.
  "C:\\", and if so, just return success. Indeed, calling
  RemoveDirectory() on such drive roots will return ERROR_ACCESS_DENIED
  otherwise, but we want to succeed even if, of course, we won't
  actually "delete" the drive root.
2020-08-19 20:36:07 +02:00
Hermès Bélusca-Maïto 2f9b4a2e9f
[CMD] RMDIR: Force directory deletion even if it's read-only, only when recursing over subdirectories (via the /S option). 2020-08-19 20:36:06 +02:00
Hermès Bélusca-Maïto 7c175d4999
[CMD] PATH, SET: Fix the returned error message when an environment variable does not exist.
Translators, please update the translations!
2020-08-19 20:36:06 +02:00
Hermès Bélusca-Maïto 6e09a6a3ff
[CMD] Use kernel32!lstrcmp(i) when comparing strings with the IF command.
Use kernel32!lstrcmp(i) instead of CRT!_tcs(i)cmp, so as to use the correct
current thread locale information when comparing user-specific strings.
As a result, the following comparison: 'b LSS B' will return TRUE,
instead of FALSE as it would be by using the CRT functions (and by
naively considering the lexicographical order in ANSI).
This behaviour has been introduced in Windows 2000 onwards.
2020-08-19 20:36:05 +02:00
Hermès Bélusca-Maïto 5830ccb85e
[CMD] Improve the way the ErrorMessage() helper and the MKDIR and RMDIR commands report their errors.
For MKDIR, also properly support the case of ERROR_FILE_EXISTS and
ERROR_ALREADY_EXISTS last-errors by displaying the standard error
"A subdirectory or file XXX already exists.\n"
2020-08-19 20:36:05 +02:00
Hermès Bélusca-Maïto 1efbcd3d5d
[CMD] Improve RMDIR help and MD error message. 2020-08-19 20:36:04 +02:00
Hermès Bélusca-Maïto e3ed502bb6
[CMD] Fix the output of the SET command. 2020-08-19 20:36:04 +02:00
Hermès Bélusca-Maïto ca4523658c
[CMD] Some code style and formatting fixes 2020-08-19 20:36:04 +02:00
Hermès Bélusca-Maïto 82bcb3f9f0
[CMD] Fix the implementation of EXIT /B when a batch context is active. 2020-08-19 20:36:03 +02:00
Hermès Bélusca-Maïto d78e8029b8
[CMD] Additional fixes for ERRORLEVEL and last returned exit code from EXIT, CALL commands and CMD.
CORE-10495 CORE-13672

- Fix how the ERRORLEVEL and the last returned exit code are set by
  EXIT and CALL commands, when batch contexts terminate, and when CMD
  runs in single-command mode (with /C).

  Addendum to commit 26ff2c8e, and reverts commit 7bd33ac4.
  See also commit 8cf11060 (r40474).

  More information can be found at:
  https://ss64.com/nt/exit.html
  https://stackoverflow.com/a/34987886/13530036
  https://stackoverflow.com/a/34937706/13530036

- Move the actual execution of the CMD command-line (in /C or /K
  single-command mode) from Initialize() to _tmain(), to put it on par
  with the ProcessInput() interactive mode.

- Make ProcessInput() also return the last command's exit code.
2020-08-19 20:36:03 +02:00
Hermès Bélusca-Maïto 2e4c8c019e
[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.
2020-08-19 20:36:01 +02:00
Hermès Bélusca-Maïto c5e6e5a19c
[CMD] GOTO: Fix handling of the ':EOF' label handling.
- The ':EOF' label feature is available only when extensions are enabled.

- Anything that follows the ':EOF' label, separated by at least one
  whitespace character, is ignored, and the batch file terminates.
2020-08-19 20:36:01 +02:00
Hermès Bélusca-Maïto f911bb482d
[CMD] GOTO: The command should search labels from its position down to the end, then loop back to the beginning of the batch and down to the original position. 2020-08-19 20:36:00 +02:00
Hermès Bélusca-Maïto 495c82ccde
[CMD] Syntax errors during parsing of batch parameters expansion, or FOR and IF commands, are fatal, and batch execution should stop.
- To this purpose use the ParseErrorEx() that correctly sets the
  bParseError flag, and return the partially-parsed command so that
  it gets echoed as well for diagnostics purposes (Windows-compatible).

- Any other parameters specified after (or before) the '/?' switch for
  the FOR and IF commands, are considered fatal syntax errors as well,
  thus we employ the ParseErrorEx() as well.
2020-08-19 20:35:59 +02:00
Hermès Bélusca-Maïto 6eb1cae348
[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.
2020-08-19 20:35:58 +02:00
Hermès Bélusca-Maïto ca912d7b36
[CMD] Further code style and formatting fixes. 2020-08-19 20:35:57 +02:00
Hermès Bélusca-Maïto c93f511241
[CMD] Reduce stack memory usage when parsing or echoing commands recursively.
- Use a common large string buffer for temporary command substitutions/expansions,
  instead of having such a buffer in the local stack of the parsing and
  echoing functions that may be called recursively. Since CMD executes
  synchronously we know that this common buffer can only be used once at
  a time.

- Also do a small code cleanup in ParseIf(), ParseFor() and ParseCommandPart().
2020-08-19 20:35:57 +02:00
Hermès Bélusca-Maïto 26cfadc352
[CMD] Make the command echoer Windows-CMD-compatible. CORE-14025
Add a MSCMD_ECHO_COMMAND_COMPAT define to be able to switch back to our
older but less broken behaviour at compile-time.

- Append a trailing space to commands when those have a parameter,
  as well as after a command-block closing parenthesis.

- Space around redirection strings need to be switched around.
2020-08-19 20:35:56 +02:00
Hermès Bélusca-Maïto 47ea3f1faa
[CMD] Fix the command echo-er/unparser.
- Use ConOutPuts() instead of ConOutPrintf() for displaying strings that
  are not printf formatted.

- When echo-ing/unparsing FOR command, any possible FOR variables
  present in the FOR parenthesized list (before the "do" part) should be
  substituted as well.
2020-08-19 20:35:56 +02:00
Hermès Bélusca-Maïto 6f87d45e1c
[CMD] Add a command tree dumper, for debugging purposes of the parser code.
This feature is also present in Windows' CMD, and has been documented
e.g. at:
https://www.fireeye.com/blog/threat-research/2018/11/cmd-and-conquer-de-dosfuscation-with-flare-qdb.html
https://www.real-sec.com/2019/08/cmd-and-conquer-de-dosfuscation-with-flare-qdb/
2020-08-19 20:35:55 +02:00
Hermès Bélusca-Maïto 04eef6d20c
[CMD] parser.c, cmd.c/h : Code style and formatting fixes.
- Change C_IFFAILURE, C_IFSUCCESS into C_OR, C_AND respectively.
2020-08-19 20:35:54 +02:00
Hermès Bélusca-Maïto 93ee4e7efa
[CMD] Fix some messages formatting.
- Fix ECHO state output string.
- Add missing newlines to some help and error messages.
- Add trailing space after the PAUSE command message.
2020-08-19 20:35:54 +02:00
Hermès Bélusca-Maïto ea801338f6
[CMD] todo.txt: Remove some points that have already been implemented since ages. 2020-08-19 20:35:52 +02:00
Hermès Bélusca-Maïto 86c5e7e41f
[CMD] Remove deprecated definition in CMakeLists.txt. 2020-08-19 20:35:52 +02:00
Hermès Bélusca-Maïto 240f6737e9
[CMD] Add a ExecuteCommandWithEcho() helper and use it in Batch() and as the implementation of RunInstance() FOR-loop helper. 2020-05-18 02:21:57 +02:00
Hermès Bélusca-Maïto ce543fbb72
[CMD] Fix the stop-batch prompt appearance: do not display it more than once in a row. 2020-05-18 02:21:57 +02:00
Hermès Bélusca-Maïto d0ced4ffdf
[CMD] Fix the ErrorMessage() function.
Specify its szFormat parameter optional, and correctly initialize the
szMessage buffer.
2020-05-18 02:21:56 +02:00
Hermès Bélusca-Maïto 9c11be5a3a
[CMD] Quick fix for the REM command parser. CORE-17030 2020-05-11 04:27:12 +02:00
Piotr Hetnarowicz cd5364ae8e [cmd] pl-pl update 2020-04-16 18:32:08 +02:00
Thomas Faber 111721a64a
[CMD] Fix another NtReadVirtualMemory parameter.
Spotted by Hermès.
2020-03-14 21:23:06 +01:00
Thomas Faber 72c51aabba
[NTOS:IO][GDI32][CMD] Fix some under-sized variables. CORE-14922
Fixes x64 boot with RTC.
2020-03-13 20:45:06 +01:00
Serge Gautherie 92aabb07fb
[REACTOS] Fix remaining ' \n' typos, in *.rc (#2393)
Addendum to commit 554c41e4 (#2387).
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2020-03-06 19:08:25 +01:00
Katayama Hirofumi MZ 4e263367f8
[CMD] Fix 'if' command for root directories (#2394)
CORE-14797
2020-02-27 23:12:19 +09:00
Katayama Hirofumi MZ a9760098f7
[CMD] Correctly parse drive-decorated pathname (#2382)
Correctly interpret the drive-decorated pathnames (C: or D:dir1 etc). CORE-15871
2020-02-26 22:28:02 +09:00
Serge Gautherie 554c41e4d7
[REACTOS] Fix trailing spaces and other typos in string resources (#2387) 2020-02-26 11:45:27 +03:00
Aaron Dewes e5813c4644
Update german translation (#2291)
* Update German translations

* Update translation again

* More translations

* Some fixes in the german translation

* Some more fixes

* Little translation tweak

* Updates to 2nd review

* Little update

* Add back keyboard accel for IDS_OPENFILELOCATION.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2020-02-08 12:55:53 +01:00
Hermès Bélusca-Maïto 771b87dc8f
[CMD] If the prompt displays the information line on top of the screen, ensure that the prompt won't be hidden below it.
CORE-16193
2019-12-29 19:14:03 +01:00
Hermès Bélusca-Maïto 0bede0062a
[CMD] Code formatting; don't hardcode the string buffer sizes in function calls. 2019-12-29 19:13:59 +01:00
Serge Gautherie f6ad093801 [CMD] Fix 'MAX_ULONG' typo in a comment (#2143) 2019-12-10 13:16:26 +01:00
Katayama Hirofumi MZ 1b7732093c
[CMD] Unquote string at pushd (#2031)
pushd command of cmd.exe didn't treat the quoted parameter correctly.
- Call StripQuotes in SetRootPath function.
- Fix typo of FEATURE_DIRECTORY_STACK.
This PR will enable "Command Prompt" here. CORE-12150
2019-11-15 11:51:58 +09:00
Eric Kohl 6bfe4f68af [LABEL][CMD] Convert the label command to a standalone executable
CORE-9444
2019-09-22 14:51:23 +02:00
Eric Kohl 432854ee18 [ATTRIB][CMD] Convert the 'attrib' command into a standalone executable
CORE-9444
2019-09-21 11:41:15 +02:00
Hermès Bélusca-Maïto 6afe79f361
[CMD] Fix typo in Norwegian translation. 2019-06-10 16:57:59 +02:00
Yaroslav Kibysh cc387650c2
[CMD] Update Ukrainian translation. (#1641) 2019-06-10 16:56:38 +02:00
Luo Yufan a0506042a6 Merge pull request #1412 from njlyf2011/improve-zh-translation
[TRANSLATION] Update Traditional Chinese translation
2019-03-11 16:50:17 +01:00
Denis Malikov 655d24d9eb [KERNEL32] make some NLS and Format functions work. Wine-sync with latest version 2019-01-05 19:01:30 +01:00
Pako Smith 6cc4e9f6f3 [CMD] Fix Coverity #715934 "Copy-paste error" (#1040)
Fix linked-list pointer comparison.
2018-11-15 11:57:41 +01:00
Katayama Hirofumi MZ 31019e8c0c [TRANSLATION] Update Romanian translation (#851)
Translation from Stefan Fulea.
CORE-15023
2018-09-14 11:04:36 +02:00
Stanislav Motylkov 7cdbdadf34 [CMD] Do not overwrite input string on Ctrl+C (#852)
CORE-15029
2018-09-13 11:47:01 +02:00
Hermès Bélusca-Maïto 3f892a8d6b
[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.
2018-08-21 14:02:24 +02:00
Adam Słaboń af3d426685 [TRANSLATION] Polish translation update (#781)
In addition: fix the encoding of the comdlg32 and ntvdm polish resource files.
2018-08-20 17:00:33 +02:00
Hermès Bélusca-Maïto 65f47728c0
[CMD] Small translation update. 2018-08-08 17:43:09 +02:00
Hermès Bélusca-Maïto 23b36fc173
[CMD] Add speed-optimized checks for dot-directories "." and ".." .
Adapted from PR #592 by Katayama Hirofumi MZ.
2018-08-06 22:40:17 +02:00
Hermès Bélusca-Maïto 17ebc8421a
[CMD] Fix the way the DIR-command pattern is interpreted when it contains paths or filenames with trailing dots.
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
2018-08-06 22:40:17 +02:00
Hermès Bélusca-Maïto c57d49d0c1
[CMD] Code formatting; use LPCTSTR where possible; use a MAX_PATH sized dircmd buffer. 2018-08-06 22:40:17 +02:00
Katayama Hirofumi MZ 12517aa309
[CMD] Create a DirNodeCleanup() helper for cleanup and simplify code (adapted from PR #592). 2018-08-06 22:40:16 +02:00
Hermès Bélusca-Maïto 06504ee4be
[CMD] Fix French translation. 2018-08-06 22:40:12 +02:00
Katayama Hirofumi MZ 706a1c5132 [CMD] "del /s directory" command doesn't show the directories or files names in the confirmation message (#680)
CORE-14059
2018-07-13 01:47:45 +02:00
Hermès Bélusca-Maïto a165999067
[CMD] Improve the situations when the console title can be changed.
- 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.
2018-06-03 02:36:39 +02:00
Hermès Bélusca-Maïto 39af25024a
[CMD] Print a newline after the interactive 'pause' command message finishes to run. 2018-06-03 02:36:32 +02:00
Hermès Bélusca-Maïto ddd03a8973
[CMD] Use string-safe call to build the new console title (possibly truncated, we don't care), avoiding any buffer overflow. Caught by David Quintana. 2018-05-20 19:57:43 +02:00
Hermès Bélusca-Maïto 03c233bcd0
[CMD] Improve how the command prompt displays when one presses Ctrl-C/break after having pressed ENTER, or after a command has been run. 2018-04-29 00:57:16 +02:00
Hermès Bélusca-Maïto a3b36f8d3e
[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.
2018-04-29 00:53:49 +02:00
Hermès Bélusca-Maïto 6dd27bd467
[CMD] Use CheckCtrlBreak(). 2018-04-29 00:50:40 +02:00
James Woodcock 8b72fce3e1
[CMD] Use _T() rather than L to initialise TCHARS. 2018-04-28 22:16:59 +02:00
James Woodcock d7e71357dc
[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.
2018-04-28 22:16:58 +02:00
James Woodcock 23de2099e0
[CMD] Don't pass CTRL-C to child processes.
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.
2018-04-28 22:16:50 +02:00
Eric Kohl 4916c4cfd5 [CMD] Correct the action on shorcut Ctrl-M
Patch by Jacob S. Preciado.

CORE-10142
2018-03-22 22:29:33 +01:00
Hermès Bélusca-Maïto f982d77b8a
[CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions.
- 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().
2018-02-02 00:41:54 +01:00
Erdem Ersoy ba3f074320 [TRANSLATIONS] Update the email address and add a note in the Turkish translation document (#271) 2018-01-07 22:09:42 +01:00
Markus Gothe e2e699118f Improve swedish translations and add new translations to swedish. 2017-12-25 11:31:22 +01:00
Hermès Bélusca-Maïto 49db8dc2a2
[CMD] Fix resource string (unrecognized escape sequence); addendum to 9a59558. 2017-12-07 22:08:54 +01:00
Hermès Bélusca-Maïto f79d268ea1
[CMD] Fix the del /s command, reported by Pablo De Napoli. CORE-10460
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.
2017-12-03 16:01:44 +01:00
Hermès Bélusca-Maïto 9a59558307
[CMD] Fix the presentation of some confirmation prompts. 2017-12-03 15:58:53 +01:00
Hermès Bélusca-Maïto 748c87202c
[CMD] Update the documentation of the FOR command. CORE-5806
- Also update & translate the french translation.
- Translators, please verify & update the translations!
2017-11-21 23:47:46 +01:00