Opened 9 years ago

Closed 9 years ago

#11180 closed defect (fixed)

wxCmdLineParser should allow "-abcd" as well as "-a -b -c -d" as per the documentation

Reported by: mfunduc Owned by:
Priority: normal Milestone: 2.9.0
Component: base Version: 2.9.0
Keywords: wxCmdLineParser switch parsing Cc:
Blocked By: Blocking:
Patch: yes


Current argument needs to be truncated when the rest is pushed to a new argument.  Patch is below.

Index: cmdline.cpp
--- cmdline.cpp    (revision 237)
+++ cmdline.cpp    (working copy)
@@ -725,6 +725,7 @@
                        next argument, in fact
                        wxString arg2 = arg[0u];
                        arg2 += arg.Mid(len + 1);
+1 for leading '-'
+                       arg = arg.Left(len + 1);  The rest gets pushed to the next argument
                            (m_data->m_arguments.begin() + n + 1, arg2);

Attachments (1)

cmdline.patch download (573 bytes) - added by mfunduc 9 years ago.

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by mfunduc

comment:1 Changed 9 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [61851]) Fix bug with parsing concatenated switches in wxCmdLineParser.

The constructs such as "-abcd" were not parsed correctly, i.e. the same as "-a
-b -c -d" because the code tried to parse a non-existent option "abcd" even if
it was supposed to not do this -- fix this.

Closes #11180.

Note: See TracTickets for help on using tickets.