# $NetBSD: opttest,v 1.3 2008/01/08 03:49:01 ginsbach Exp $ # # GNU libc tests with these # optstring: abc: longopts: 5 longopt: required, required_argument, , 'r' longopt: optional, optional_argument, , 'o' longopt: none, no_argument, , 'n' longopt: color, no_argument, , 'C' longopt: colour, no_argument, , 'C' # args: foo --req foobar result: -required=foobar|0 # args: foo --opt=bazbug result: -optional=bazbug|0 # # This is promblematic args: foo --col # GNU libc 2.1.3 this fails with ambiguous #result: !?|0 # GNU libc 2.2 >= this works result: -color|0 # args: foo --colour result: -colour|0 # # This is the real GNU libc test! args: foo -a -b -cfoobar --required foobar --optional=bazbug --none random \ --col --color --colour # GNU libc 2.1.3 this fails with ambiguous #result: a,b,c=foobar,-required=foobar,-optional=bazbug,-none,!?,-color,-colour|1 # GNU libc 2.2 >= this works result: a,b,c=foobar,-required=foobar,-optional=bazbug,-none,-color,-color,-colour|1 # # The order of long options in the long option array should not matter. # An exact match should never be treated as ambiguous. # optstring: fgl longopts: 3 longopt: list-foobar, no_argument, lopt, 'f' longopt: list-goobar, no_argument, lopt, 'g' longopt: list, no_argument, lopt, 'l' # args: foo --list result: -list|0