]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3925: lilypond -d leads to weird output
authorDavid Kastrup <dak@gnu.org>
Sun, 1 Jun 2014 14:30:04 +0000 (16:30 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 5 Jun 2014 10:35:23 +0000 (12:35 +0200)
C++ string manipulation is a fragile bolt-on onto the type system.

"-" + 'd'

evaluates to a pointer 100 bytes after a constant string "-" in the data
section.  This fixes this bug, and also changes the fixed message from

    lilypond: option `-d, `--define-default'' requires an argument

to

    lilypond: option `-d, --define-default' requires an argument

In general, it does not appear to make sense quoting the long options
while not quoting the short options.

flower/getopt-long.cc

index 458c2374cafb97f785b086c74e10127b6b5ce8ea..0d6da2c60e5e9c036c615e321173d0c765679142 100644 (file)
@@ -103,11 +103,11 @@ Long_option_init::to_string () const
 {
   string str;
   if (shortname_char_)
-    str += "-" + shortname_char_;
+    str += string ("-") + shortname_char_;
   if (shortname_char_ && longname_str0_)
     str += ", ";
   if (longname_str0_)
-    str += string ("`--") + longname_str0_ + "'";
+    str += string ("--") + longname_str0_;
   return str;
 }