Re: cmdline_file_save accepts file handler instead

"Papp Gyozo (VBuster)" <[email protected]> Wed, 31 Oct 2007 13:16:33 +0100
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Hi,

> sorry, I'm not sure I understood which is the correct patch...

Sorry I was in a big hurry that night (ie. I didn't switch to Linux to test this patch)

Now here it is, the patch against gengetopt 2.21, not recent CVS but IMHO it doesn't matter in this case.

_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt
multiword_options_in_config.patch (text/x-diff, 701 B)
--- c_source.h_skel.orig	2007-07-28 12:29:19.000000000 +0200
+++ c_source.h_skel	2007-09-29 10:12:11.000000000 +0200
@@ -702,8 +702,12 @@
             }
         }
       else
-        { /* read up the remaining part up to a delimiter */
-          next_token = strcspn (farg, " \t\r\n#\'\"");
+        { /* read up the remaining part  up to end of line 
+	   * or comment sign (#) or a double qoute (") which must be escaped */
+          char *ch = (str_index + (next_token = strcspn (farg, "\r\n\"#")));
+          /* remove trailing whitespaces */
+          for ( --ch; (*ch >= 0x09 && *ch <= 0x0D) || *ch == ' '; --ch )
+            --next_token;
           str_index += next_token;
         }