lib/getopt.c


Log

Author Commit Date CI Message
Paul Eggert 51e801f2 2012-01-05T23:53:49 In commentary, do not use ` to quote.
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Eric Blake c4bf665b 2011-07-07T08:54:11 getopt: handle W; without long options in getopt This reverts commit cbf381169705782b144b2733798a62c11aa473a5, in favor of the upstream glibc fix (commit 01636b214) plus a C89 fix. [BZ #12922] * lib/getopt.c (_getopt_internal_r): When "W;" is in short options but no long options are defined, just return 'W'. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake cbf38116 2011-06-22T11:17:40 getopt: silence clang warning http://sourceware.org/bugzilla/show_bug.cgi?id=12922 Only triggered by a program that uses "W;" in the short opt string without providing a longopts array; that can be argued to be a programmer error, so gnulib won't bother replacing glibc getopt if it has that bug. * lib/getopt.c (_getopt_internal_r): Avoid unlikely NULL dereference. Reported by Gustavo Martin Domato. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 3d7fa330 2011-06-04T15:32:18 getopt: Avoid gcc warning. * lib/getopt.c (_getopt_internal_r): Remove unused variable 'ambig'.
James Youngman 70aa91cc 2011-05-26T01:45:13 getopt: for ambiguous options, enumerate the possibilities. * lib/getopt.c (_getopt_internal_r): Merge glibc change printing the ambiguous options when an ambiguous prefix is given. This was http://sourceware.org/bugzilla/show_bug.cgi?id=7101. The merged glibc change was http://sourceware.org/git/?p=glibc.git;a=commit;h=bd25564e1e98910ed69043ed6a6f884ce60e5780.
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Eric Blake e7b3c4c7 2010-04-16T14:08:15 getopt: allow compilation with C++ A C++ compiler complains that REQUIRE_ORDER is unknown if it is buried inside the struct. * lib/getopt_int.h (__ordering): Hoist enum declaration outside struct. * lib/getopt.c (_getopt_internal_r): Use correct type. Reported by Dagobert Michelson, via Joel E. Denny. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake db3e2806 2010-04-10T11:56:34 getopt: merge bug fixes from glibc * lib/getopt.c (_getopt_internal_r): Use correct message for 'W;' diagnostics. Honor '+:' correctly. Reject ';'. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 71328e33 2010-03-19T06:29:16 getopt: avoid compiler warning * lib/getopt.c (attribute_hidden): Remove unused macro. Signed-off-by: Eric Blake <eblake@redhat.com>
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Eric Blake 169ab5de 2009-12-22T15:14:49 gnulib-common: prefer _GL_UNUSED over _UNUSED_PARAMETER_ There are more contexts where __attribute__((__unused__)) is useful than just parameter lists. Also, naming the macro _GL_UNUSED fits with the recent addition of _GL_ARG_NONNULL. Preserve the name _UNUSED_PARAMETER_ for backwards-compatible use in external projects. * m4/gnulib-common.m4 (gl_COMMON): Create a more-appropriately named alias for __attribute__((__unused__)). * lib/chown.c: Update client. * lib/fchmodat.c: Likewise. * lib/fts.c: Likewise. * lib/getdate.y: Likewise. * lib/getgroups.c: Likewise. * lib/getopt.c: Likewise. * lib/getugroups.c: Likewise. * lib/mkdir.c: Likewise. * lib/mkfifo.c: Likewise. * lib/mkfifoat.c: Likewise. * lib/mknod.c: Likewise. * lib/mknodat.c: Likewise. * lib/readlink.c: Likewise. * lib/se-context.in.h: Likewise. * lib/se-selinux.in.h: Likewise. * lib/sockets.c: Likewise. * lib/symlink.c: Likewise. * lib/symlinkat.c: Likewise. * lib/unicodeio.c: Likewise. * lib/unistr.h: Likewise. * tests/test-areadlink.c: Likewise. * tests/test-areadlinkat.c: Likewise. * tests/test-filenamecat.c: Likewise. * tests/test-fseeko.c: Likewise. * tests/test-ftello.c: Likewise. * tests/test-getdate.c: Likewise. * tests/test-getgroups.c: Likewise. * tests/test-gethostname.c: Likewise. * tests/test-quotearg.c: Likewise. * tests/test-version-etc.c: Likewise. * tests/test-xalloc-die.c: Likewise. * tests/test-xfprintf-posix.c: Likewise. * tests/test-xprintf-posix.c: Likewise. * tests/test-xvasprintf.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 2494f34b 2009-12-16T12:03:14 getopt: synchronize from glibc Make gnulib closer to glibc, to make tracking it easier to track extent of pending patches against glibc. * lib/getopt.c (_getopt_initialize, _getopt_internal_r): Swap parameter order. Adjust all callers. (_getopt_internal_r, main): Adjust quoting in error messages. Drop considerations for outdated POSIX 1003.2 error message. * lib/getopt1.c (_getopt_long_r, _getopt_long_only_r): Adjust callers. * lib/getopt_int.h (_getopt_internal_r): Adjust prototype. Signed-off-by: Eric Blake <ebb9@byu.net>
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
Eric Blake 708e2420 2009-10-30T09:47:12 build: avoid compiler warnings * lib/fchmodat.c (lchmod): Mark unused variables. * lib/getopt.c (_getopt_initialize): Likewise. * lib/mktime.c (__mktime_internal): Provide prototype. * lib/inttostr.c (inttostr): Avoid compiler warning even with older gcc that do not understand #pragma GCC diagnostic. * lib/uinttostr.c (inttype_is_unsigned): Define. * lib/umaxtostr.c (inttype_is_unsigned): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
John E. Malmberg 84a14b9a 2008-03-03T12:39:56 Update VMS specifics.
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Eric Blake f180e0b3 2006-09-14T00:53:04 * getopt.c: Fix typo in last commit.
Paul Eggert 0632e115 2006-09-13T22:38:14 * _fpending.c: Include <config.h> unconditionally, since we no longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
Paul Eggert d76a6493 2006-07-06T23:29:27 * lib/getloadavg.c: Use __VMS, not VMS. * lib/getopt.c: Likewise. * lib/getpagesize.h: Likewise. * lib/glob.c: Remove most VMS cruft; it hasn't been tested for a while and probably does not work. * lib/backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. (HAVE_DIR): Remove. All uses removed; we now assume you can read directories. * lib/dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. * lib/fts.c: Likewise. * lib/getcwd.c: Likewise. * lib/glob.h: Likewise. * lib/savedir.c: Likewise. * m4/backupfile.m4 (gl_BACKUPFILE): Check for dirent.h, instead of invoking obsolescent AC_HEADER_DIRENT macro. * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. * m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Likewise. * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. * m4/fts.m4 (gl_FUNC_FTS_CORE): Likewise. * m4/getcwd.m4 (gl_PREREQ_GETCWD): Likewise. * m4/glob.m4 (gl_PREREQ_GLOB): Likewise. * m4/savedir.m4 (gl_SAVEDIR): Likewise. * m4/readdir.m4: Remove; no longer needed.
Paul Eggert 673458cf 2006-01-24T07:40:58 Work around porting bugs reported by Dieter in <http://lists.gnu.org/archive/html/bug-bison/2006-01/msg00049.html>. * lib/getopt.c (_NOPROTO): Remove; no longer needed. Include <stdlib.h> and <unistd.h> in all environments; it's safe now. Include "getopt.h" first, to check interface. (getenv): Declare only if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV. * lib/strndup.c [!_LIBC]: Include "strndup.h" to get prototype. (__strndup): Revert to K&R-style function dfns, the glibc style. * lib/strnlen.c: Don't claim it's taken from glibc; it's not. (strnlen, __strnlen): Remove #defines and #undefs; not needed. Include strnlen.h first, to get prototype properly. (strnlen): Renamed from __strnlen. Remove weak alias. * m4/getopt.m4 (gl_PREREQ_GETOPT): Check for getenv decl.
Paul Eggert 267a39ba 2005-05-14T06:03:57 *** empty log message ***
Paul Eggert 4d60dc8a 2004-11-17T01:52:35 (POSIXLY_CORRECT): New constant.
Paul Eggert 06ee59a5 2004-11-17T01:13:54 Merge from coreutils to support a more-standard getopt.
Paul Eggert e7c29a3e 2004-11-11T21:15:33 (_getopt_initialize, _getopt_internal_r, _getopt_internal, getopt): Use __getopt_argv_const.
Paul Eggert 8f3f62dc 2004-08-12T07:59:56 Remove ELIDE_CODE hack.
Karl Berry fb510519 2004-03-11T13:04:48 autoupdate
Paul Eggert 32eb10d7 2004-03-09T19:42:23 Sync getopt and argp from libc CVS.
Paul Eggert 6d2408b7 2003-09-09T18:36:53 Remove K&R cruft in getopt.
Karl Berry b7476078 2002-11-25T00:17:33 change license to gpl.
Bruno Haible f9fa25dc 2002-11-05T21:45:29 Include gettext.h instead of <libintl.h> with #ifdefs.
Karl Berry 39d38083 2002-09-25T14:19:24 update from libc
Jim Meyering 282ed205 2001-10-21T10:55:29 (_): Honor the setting of ENABLE_NLS. Otherwise, this code would end up calling gettext even in packages built with --disable-nls.
Jim Meyering 49ac54cc 2001-08-12T13:02:20 update from libc
Jim Meyering 27463582 2000-10-17T06:45:49 Update from libc.
Jim Meyering ba39214f 2000-09-10T07:31:44 (_getopt_internal): Update from glibc.
Jim Meyering 0e167051 2000-09-06T20:04:06 (_getopt_internal): Update from glibc.
Jim Meyering 618f09f7 2000-05-04T05:34:55 Update from glibc.
Jim Meyering 4c8efe43 1999-10-11T12:39:14 update from GNU lib C
Jim Meyering dd82a0db 1999-01-13T05:36:45 new version from glibc
Jim Meyering 62227802 1998-04-05T21:32:26 add braces to disambiguate ambiguous else
Jim Meyering 127435fc 1997-05-27T09:38:06 Update from glibc via patch-2.2.93.
Jim Meyering 4a357dd7 1997-01-23T02:45:02 Update from GNU via Uli
Jim Meyering 7a251ca9 1997-01-18T13:44:49 reindent
Jim Meyering 59f4963c 1997-01-08T22:40:00 (_getopt_internal): Use `_', rather than the (sometimes-)expansion `gettext'.
Jim Meyering 5097a8fa 1997-01-08T04:52:00 [_]: Define to gettext also if ENABLE_NLS is defined.
Jim Meyering 8b7d1078 1997-01-08T04:11:29 New (more POSIX compliant) version from GNU libc.
Jim Meyering 1fead1bd 1996-07-11T03:57:04 use latest from gettext-0.10.23
Jim Meyering 00512eb7 1995-10-18T14:29:16 Get latest from FSF.
Jim Meyering 8bdf2d32 1995-08-04T15:09:12 .
Jim Meyering 6fdf9952 1995-08-04T14:30:19 (_getopt_internal) [lint]: Initialize INDFOUND to avoid warning from gcc.
Jim Meyering b5da0734 1995-04-27T06:06:46 merge with 1.11.f
Jim Meyering cb0e9ba1 1995-03-20T15:09:56 sync from FSF
Jim Meyering a99e0db3 1995-02-28T12:06:57 Remove sys-dependent cruft and define-away getopt in system headers instead.
Jim Meyering 3568b0f6 1994-11-21T14:23:15 .
Jim Meyering 01c23d40 1994-11-03T00:58:46 merge with 1.10x1
Jim Meyering 8f16c54c 1994-09-27T20:52:18 merge with 1.10n1
Jim Meyering 56f88f60 1994-07-13T14:11:52 merge with 1.10e
Jim Meyering cba9751a 1994-05-13T14:21:20 .
Jim Meyering 21d35002 1994-04-19T13:40:49 merge with 1.9.4e
Jim Meyering b6ef595f 1994-04-04T22:19:38 merge with 1.9.4d
Jim Meyering ede75a0b 1994-03-08T16:01:22 merge with 1.9.4a
Jim Meyering 6a75c0b2 1994-02-12T17:23:51 merge with 1.9.2i
Jim Meyering 3fb00e68 1994-02-10T19:14:34 merge with 1.9.2g
Jim Meyering 94c2b308 1993-12-29T04:40:34 merge with 1.9.2b
Jim Meyering cd47583b 1993-10-04T21:20:39 merge with 1.8.1a
Jim Meyering e14f6869 1993-09-08T05:08:08 new versions
Jim Meyering 43e78b97 1992-11-01T05:44:30 Initial revision