This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

getopt_long


The attached program experiments with getopt_long.  It prints optarg for
each option, or (null) if optarg is NULL.  If I attempt to use the -o
option I get the following results.

$ ./getopt_test -o
optional argument: (null) 

$ ./getopt_test -o arg
optional argument: (null)
Non - option ARGV elements: arg 

This happens for me with glibc 2.1.2 on x86 and ARM.

The -o option is supposed to take an optional argument.  The
documentation leads me to believe that optarg will be set if an argument
for the option exists.  Have I missed something or is this a bug?

Scott

-- 
Scott Bambrough - Software Engineer
REBEL.COM    http://www.rebel.com
NetWinder    http://www.netwinder.org

getopt_test.c


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]