Commit Graph

11 Commits

Author SHA1 Message Date
Thomas Kindler 9dd3c3b0ad newlib: getopt now permutes multi-flag options correctly
Previously, "test 1 2 3 -a -b -c"  was permuted to "test -a -b -c 1 2 3",
but "test 1 2 3 -abc" was left as "test 1 2 3 -abc".

Signed-off-by: Thomas Kindler <mail+newlib@t-kindler.de>
2018-06-18 18:45:44 +02:00
Corinna Vinschen 2b2290caba * newlib/libc/stdlib/getopt.c (getopt_internal): Add missing braces. 2013-11-13 20:04:18 +00:00
Corinna Vinschen 02365c2064 * newlib/libc/include/getopt.h (struct option): name field should be
"const char *".
	* newlib/libc/stdlib/getopt.c (getopt_internal): Use fputs()/fputc()
	instead of fprintf() to save code space.  Fix signed/unsigned
	comparison.
2013-11-13 09:09:45 +00:00
Corinna Vinschen f1359420da * libc/libc/stdlib/getopt.c (getopt_internal): Fix NULL pointer access. 2013-11-12 11:30:32 +00:00
Corinna Vinschen 3595a9c789 * libc/stdlib/getopt.c (getopt_internal): Align handling of colon to
SUSv4 requirements.
	(__getopt_long_r): Fix formatting.
2012-10-16 19:11:48 +00:00
Jeff Johnston c622842865 2008-03-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/getopt.h: Hide newlib extensions under
        the __need_getopt_newlib flag.
        * libc/stdlib/getopt.c: #define __need_getopt_newlib before including
        getopt.h.  Put entire code under !HAVE_GETOPT to support platforms
        with their own getopt implementation.
        * configure.host: Specify HAVE_GETOPT for x86-linux.
2008-03-07 18:16:35 +00:00
Jeff Johnston 76ff710cfa 2008-02-29 Gregory Pietsch <gpietsch@comcast.net>
* libc/stdlib/getopt.c (getopt_internal): Rewrite to accept
        data area so as to support reentrant calls.  Change all callers
        to fill in data area with global values and restore any changes
        to the global values after call.
        (__getopt_r, __getopt_long_r, __getopt_long_only_r): New routines
        to support reentrancy that add a data area argument.
        * libc/include/getopt.h: Add new _r routines and provide macros
        so they can be called with using double-underscores.
2008-02-29 21:11:57 +00:00
Jeff Johnston f46f40b54e 2008-02-12 Peter Rosin <peda@lysator.liu.se>
* libc/stdlib/getopt.c (getopt_internal): Handle optional
        arguments better for long options and short options not
        appearing as the first option in a sequence.
2008-02-12 17:20:09 +00:00
Eric Blake b206478328 Avoid more compiler warnings.
* libc/stdlib/btowc.c: Add missing header.
* libc/stdlib/getopt.c (getopt_internal): Initialize variable.
* libc/stdlib/system.c (do_system) [__CYGWIN__]: Add declaration.
* libc/stdlib/wctob.c: Add missing header.
* libc/string/strcpy.c (strcpy): Avoid warnings.
* libc/string/strrchr.c (strrchr): Likewise.
2007-05-29 21:26:59 +00:00
Jeff Johnston 791c9bda57 2006-01-04 Gregory Pietsch <gpietsch@comcast.net>
* libc/stdlib/getopt.c: Replaced with version
        that adds getopt_long and getopt_long_only support.
        * libc/include/getopt.h: New file.
2006-01-04 21:21:52 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00