Thread overview
[Issue 2142] New: getopt() doesn't process bundled comman-line options properly
Jun 06, 2008
d-bugmail
[Issue 2142] getopt() incorrectly processes bundled comman-line options
Jun 26, 2008
d-bugmail
June 06, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2142

           Summary: getopt() doesn't process bundled comman-line options
                    properly
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: kolos80@bk.ru


getopt() sees only one short option in bundled options - the one that is given
to getopt() first.

Example:
 boo f_linenum, f_filename;
 getopt
  (
    args,
    std.getopt.config.bundling,
    //std.getopt.config.caseSensitive,
    "linenum|l", &f_linenum,
    "filename|n", &f_filename
  );
In `-ln' and `-nl' options only `l' will be recognized in this case.
And if  we will change the order like this:
  ...
  "filename|n", &f_filename,
  "linenum|l", &f_linenum
  ...
`n' will be recognized, but `l' will be skipped

I think, it's from line 538 of getopt.d:
536  if (cfg.bundling && !isLong && v.length == 1
537    && std.string.find(arg, v) >= 0)
538  return true;    <--- this is wrong

P.S. I cannot check my solution, because phobos doesn't compile:
Error: multiple definition of object-2: _D8object.212__ModuleInfoZ and object:
_
D8object.212__ModuleInfoZ


-- 

June 26, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2142





------- Comment #1 from kolos80@bk.ru  2008-06-26 02:23 -------
I found that if short option is recognized, then the whole argument containing it is removed from <args>, leaving all remaining bundled options unprocessed.


-- 

October 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2142


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2142


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-09-26 08:25:34 PDT ---
http://www.dsource.org/projects/phobos/changeset/2050

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------