• Show log

    Commit

  • Hash : c0c5acfb
    Author : Eric Blake
    Date : 2009-11-27T17:47:21

    getopt-gnu: flush out another BSD bug
    
    POSIX requires 'echo foo > bar; m4 -Dfoo=1 bar -Dfoo=2 bar' to
    output '1' then '2'.  To achieve this, m4 relies on the GNU
    getopt{,_long} extension of a leading '-'.  However, BSD getopt
    fails to honor this extension when POSIXLY_CORRECT.
    
    Also, BSD getopt fails to reparse POSIXLY_CORRECT from the
    environment even when a reset is requested (whether by
    optreset=1 or by optind=0).
    
    * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Test for the bug.
    * tests/test-getopt.c (main): Check POSIXLY_CORRECT first, to
    flush out BSD bug.
    * tests/test-getopt.h (test_getopt): End lists with NULL.
    * tests/test-getopt_long.h (test_getopt_long): Likewise.
    (test_getopt_long_posix): Enhance test.
    * modules/getopt-posix-tests (Depends-on): Add stdbool.
    * doc/glibc-functions/getopt_long.texi (getopt_long): Mention
    getopt-gnu.
    * doc/glibc-functions/getopt_long_only.texi (getopt_long_only):
    Likewise.
    
    Signed-off-by: Eric Blake <ebb9@byu.net>