]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #87580 - ChrisDenton:win-arg-parse-2008, r=m-ou-se
authorbors <bors@rust-lang.org>
Thu, 2 Sep 2021 16:16:13 +0000 (16:16 +0000)
committerbors <bors@rust-lang.org>
Thu, 2 Sep 2021 16:16:13 +0000 (16:16 +0000)
commit1cf8fdd4f0be26bcfa9e3b1e10d4bf80107ba492
treec3c227121d1ac48d951f55a5a9af387911130328
parentfcce644119cf4e8e36001368e514bb5ed67cb855
parente26dda564219341e25589ff745b16258ad424b78
Auto merge of #87580 - ChrisDenton:win-arg-parse-2008, r=m-ou-se

Update Windows Argument Parsing

Fixes #44650

The Windows command line is passed to applications [as a single string](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/the-windows-command-line-is-just-a-string) which the application then parses to get a list of arguments. The standard rules (as used by C/C++) for parsing the command line have slightly changed over the years, most recently in 2008 which added new escaping rules.

This PR implements the new rules as [described on MSDN](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-160#parsing-c-command-line-arguments) and [further detailed here](https://daviddeley.com/autohotkey/parameters/parameters.htm#WIN). It has been tested against the behaviour of C++ by calling a C++ program that outputs its raw command line and the contents of `argv`. See [my repo](https://github.com/ChrisDenton/winarg/tree/std) if anyone wants to reproduce my work.

For an overview of how this PR changes argument parsing behavior and why we feel it is warranted see https://github.com/rust-lang/rust/pull/87580#issuecomment-893833893.

For some examples see: https://github.com/rust-lang/rust/pull/87580#issuecomment-894299249
library/std/src/lib.rs
library/std/src/sys/windows/c.rs