Re: gengetopt: bug found in gm.cc:584

Lorenzo Bettini <[email protected]>
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Ch'Gans wrote:
> Hi all,
> 
> I found a bug when using --long-help, I have used genpetopt 2.17
> (manually installed on a mandriva 10.1), with and without my last patch,
> and the gengetopt shipped with my distro (2.12.2). All these version
> lead to the bug.

you're right, again! :-)

here's a quick patch (I've tested and it seems to work, but I'll perform 
more tests).  This is against the version I'm working on, so the lines 
might be different from the one in version 2.17, but you should be able 
to correct the problem with this patch.

hope to hear from you soon

cheers
	Lorenzo

diff -c -r1.107 gm.cc
*** gm.cc	4 Sep 2006 06:39:43 -0000	1.107
--- gm.cc	13 Sep 2006 09:53:11 -0000
***************
*** 557,562 ****
--- 557,572 ----
         foropt
           if (opt->required && !opt->hidden) /* required options */
             switch (opt->type) {
+           case ARG_NO:
+           case ARG_FLAG:
+             usage << "[";
+             if (opt->short_opt)
+               {
+                 usage << "-" << opt->short_opt << "|";
+               }
+             usage << "--" << opt->long_opt << "] ";
+             break;
+
             case ARG_INT:
             case ARG_SHORT:
             case ARG_LONG:


-- 
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.