[Bug 1448] Report wrong command-line options

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri May 10 14:27:32 EST 2013


https://bugzilla.mindrot.org/show_bug.cgi?id=1448

Darren Tucker <dtucker at zip.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at zip.com.au

--- Comment #4 from Darren Tucker <dtucker at zip.com.au> ---
whatever it is, it doesn't seem to be gnu-getopt specific.  or if it
is, it's not enabled with the default set of defines.

#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    int ch;
    while ((ch = getopt(argc, argv, "abc:")) != -1) {
        printf("opt %c optarg %s\n", ch, optarg ? optarg : "(null)");
    }
}

gives me:
$ ./a.out --foo      
./a.out: invalid option -- '-'
opt ? optarg (null)
./a.out: invalid option -- 'f'
opt ? optarg (null)
./a.out: invalid option -- 'o'
opt ? optarg (null)
./a.out: invalid option -- 'o'
opt ? optarg (null)

whatever it is, I think it's in our compat library:
$ nm scp | grep -i getop
08051710 T BSDgetopt

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list