From 8dd4c6113d2d4c08ed5976fe15baf683ebaa6826 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 31 Mar 2013 01:11:47 +0000 Subject: [PATCH] Add a comment with links to proper command line parsing rules. No real changes, just added a comment with links to the descriptions of the correct rules that we should use in ConvertStringToArgs(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/cmdline.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index bb5bd83b93..2d6feae46b 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -1377,6 +1377,23 @@ static wxString GetLongOptionName(wxString::const_iterator p, Windows conventions for the command line handling, not Unix ones. For instance, backslash is not special except when it precedes double quote when it does quote it. + + TODO: Rewrite this to follow the even more complicated rule used by Windows + CommandLineToArgv(): + + * A string of backslashes not followed by a quotation mark has no special + meaning. + * An even number of backslashes followed by a quotation mark is treated as + pairs of protected backslashes, followed by a word terminator. + * An odd number of backslashes followed by a quotation mark is treated as + pairs of protected backslashes, followed by a protected quotation mark. + + See http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx + + It could also be useful to provide a converse function which is also + non-trivial, see + + http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx */ /* static */ -- 2.45.2