lib/getopt.c


Log

Author Commit Date CI Message
Bruno Haible 44b65c48 2018-05-03T23:09:42 Simplify code. Drop support for Borland C++ on Windows. Reported by Gisle Vanem <gisle.vanem@gmail.com>. * lib/accept4.c: Simplify 'defined _WIN32 || defined __WIN32__' to just 'defined _WIN32'. * lib/canonicalize-lgpl.c: Likewise. * lib/classpath.c: Likewise. * lib/clean-temp.c: Likewise. * lib/csharpexec.c: Likewise. * lib/ctime.c: Likewise. * lib/dosname.h: Likewise. * lib/dup2.c: Likewise. * lib/errno.in.h: Likewise. * lib/error.c: Likewise. * lib/euidaccess.c: Likewise. * lib/execute.c: Likewise. * lib/fcntl.in.h: Likewise. * lib/fcntl.c: Likewise. * lib/filename.h: Likewise. * lib/findprog.c: Likewise. * lib/flock.c: Likewise. * lib/fopen.c: Likewise. * lib/freopen.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/gc-gnulib.c: Likewise. * lib/get-rusage-data.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getdelim.c: Likewise. * lib/getdtablesize.c: Likewise. * lib/gethostname.c: Likewise. * lib/getlogin.c: Likewise. * lib/getlogin_r.c: Likewise. * lib/getopt.c: Likewise. * lib/getpagesize.c: Likewise. * lib/getpass.c: Likewise. * lib/getrusage.c: Likewise. * lib/gettimeofday.c: Likewise. * lib/glob.c: Likewise. * lib/inttypes.in.h: Likewise. * lib/isapipe.c: Likewise. * lib/javaexec.c: Likewise. * lib/link.c: Likewise. * lib/localcharset.c: Likewise. * lib/localename.h: Likewise. * lib/localename.c: Likewise. * lib/localtime.c: Likewise. * lib/lseek.c: Likewise. * lib/mbsinit.c: Likewise. * lib/mkdir.c: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/nanosleep.c: Likewise. * lib/nl_langinfo.c: Likewise. * lib/nonblocking.c: Likewise. * lib/nproc.c: Likewise. * lib/open.c: Likewise. * lib/openpty.c: Likewise. * lib/pathmax.h: Likewise. * lib/pipe-filter-aux.c: Likewise. * lib/pipe-filter-gi.c: Likewise. * lib/pipe-filter-ii.c: Likewise. * lib/pipe.c: Likewise. * lib/pipe2.c: Likewise. * lib/poll.c: Likewise. * lib/popen.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/printf-parse.c: Likewise. * lib/progreloc.c: Likewise. * lib/putenv.c: Likewise. * lib/read.c: Likewise. * lib/relocatable.c: Likewise. * lib/rename.c: Likewise. * lib/same-inode.h: Likewise. * lib/secure_getenv.c: Likewise. * lib/select.c: Likewise. * lib/sethostname.c: Likewise. * lib/setlocale.c: Likewise. * lib/sigaction.c: Likewise. * lib/sigprocmask.c: Likewise. * lib/sleep.c: Likewise. * lib/spawn-pipe.h: Likewise. * lib/spawn-pipe.c: Likewise. * lib/spawni.c: Likewise. * lib/stat-time.h: Likewise. * lib/stat-w32.c: Likewise. * lib/stat.c: Likewise. * lib/stdio.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/stdlib.in.h: Likewise. * lib/strerror_r.c: Likewise. * lib/strftime-fixes.c: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/sys_wait.in.h : Likewise. * lib/system-quote.h: Likewise. * lib/system-quote.c: Likewise. * lib/tmpdir.c: Likewise. * lib/tzset.c: Likewise. * lib/uname.c: Likewise. * lib/unistd.in.h: Likewise. * lib/utime.in.h: Likewise. * lib/utime.c: Likewise. * lib/utimecmp.c: Likewise. * lib/utimens.c: Likewise. * lib/vasnprintf.c: Likewise. * lib/vma-iter.h: Likewise. * lib/vma-iter.c: Likewise. * lib/wait-process.c: Likewise. * lib/wcsftime.c: Likewise. * lib/wctype.in.h: Likewise. * lib/write.c: Likewise. * tests/nap.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-get-rusage-data.c: Likewise. * tests/test-getaddrinfo.c: Likewise. * tests/test-getlogin.h: Likewise. * tests/test-isatty.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-mbrtowc-w32.c: Likewise. * tests/test-nonblocking.c: Likewise. * tests/test-nonblocking-pipe-main.c: Likewise. * tests/test-nonblocking-socket-main.c: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * tests/test-poll.c: Likewise. * tests/test-pthread_sigmask1.c: Likewise. * tests/test-select.h: Likewise. * tests/test-sethostname2.c: Likewise. * tests/test-sigprocmask.c: Likewise. * tests/test-spawn-pipe-child.c: Likewise. * tests/test-stat-time.c: Likewise. * tests/test-system-quote-main.c: Likewise. * tests/test-utimens-common.h: Likewise. * tests/test-wcrtomb-w32.c: Likewise. * m4/csharpexec.m4 (gt_CSHARPEXEC): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. * m4/javacomp.m4 (gt_JAVACOMP): Likewise. * m4/javaexec.m4 (gt_JAVAEXEC): Likewise. * m4/locale-ar.m4 (gt_LOCALE_AR): Likewise. * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Likewise. * m4/nocrash.m4 (GL_NOCRASH): Likewise. * m4/pathmax.m4 (gl_PATHMAX_SNIPPET): Likewise. * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/tmpfile.m4 (gl_FUNC_TMPFILE): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
Paul Eggert 281b825e 2018-01-01T00:57:25 maint: Run 'make update-copyright'
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Paul Eggert 19fb4184 2017-05-11T17:59:25 getopt-posix: port to mingw * lib/getopt.c (flockfile, funlockfile): Define on mingw. Problem reported by Daniel P. Berrage in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00086.html
Zack Weinberg d9c418c8 2017-04-06T11:14:14 getopt: annotate files with relationship to glibc As the final act in this patchset, adjust the message at the top of each file to indicate which files are synced with glibc. (This has already been done for most of the headers.) * lib/getopt.c, lib/getopt1.c, lib/getopt_int.h: Mention in top-of-file boilerplate that these files are shared between glibc and gnulib.
Zack Weinberg f8667251 2017-04-06T11:14:14 getopt: better handling of ambiguous options glibc's getopt uses alloca to construct a linked list of possibilities for an "ambiguous" long option. In gnulib, malloc should be used instead. Providing for both cases complicates things a fair bit. This patch rewrites ambiguous-option handling to use a boolean vector instead of a linked list. There is then only one allocation that might need freeing; in glibc it can honor __libc_use_alloca as usual, and in gnulib we define __libc_use_alloca to always be false, so we don't need ifdefs in the middle of the function. This should also be slightly more efficient in the normal case of long options being fully spelled out -- I think most people aren't even aware they _can_ sometimes abbreviate long options. One interesting consequence is that the list of possibilities is now printed in exactly the order they appear in the list of long options, instead of the first possibility being shuffled to the end. (The patch looks bigger than it really is because there's a fair bit of reindentation and code rearrangement.) * lib/getopt.c: When used standalone, define __libc_use_alloca as always false and alloca to abort if called. (process_long_option): Rewrite handling of ambiguous long options to use a single boolean vector, not a linked list; use __libc_use_alloca to decide whether to allocate this using alloca.
Zack Weinberg 62cb366e 2017-04-06T11:14:14 getopt: refactor long-option handling There were two copies of the bulk of the code to handle long options. Now there is only one. This change temporarily removes the logic to avoid using alloca when standalone; the next patch in the series will restore it. * lib/getopt.c (process_long_option): New function split out from _getopt_internal_r. (_getopt_internal_r): Replace both copies of the long-option processing code with calls to process_long_option.
Zack Weinberg ef3ea3cc 2017-04-06T11:14:14 getopt: tidy up _getopt_initialize a bit _getopt_data.__posixly_correct is completely redundant to _getopt_data.__ordering, and some work that logically belongs in _getopt_initialize was being done by _getopt_internal_r, making the code harder to understand. As a side effect, getenv will no longer be called if the first character of the options string is '+' or '-', which is probably a Good Thing. (Perhaps we should have a flag character that specifically asks for the permutation behavior?) * lib/getopt_int.h (_getopt_data): Remove __posixly_correct field. * lib/getopt.c (_getopt_internal_r): Move some initialization code... (_getopt_initialize): ...here. Don't set d->__posixly_correct.
Zack Weinberg d72c5a7b 2017-04-06T11:14:14 getopt: merge from glibc: repetition reduction The definitions of the entry point functions 'getopt' and '__posix_getopt' can be made substantially less repetitive with a helper macro. While I was merging the const-correctness changes from gnulib into glibc I noticed there are still some unnecessary casts in _getopt_internal_r. * lib/getopt.c (getopt, __posix_getopt): Eliminate repetition with a macro. Consistently cast 'argv' to 'char **' when calling _getopt_internal. (_getopt_internal_r): Remove unnecessary casts when calling exchange.
Zack Weinberg dcfe5a0e 2017-04-06T11:14:14 getopt: clean up error reporting getopt can print a whole bunch of error messages, and when used standalone (from gnulib) it uses fprintf to do that. But fprintf is a cancellation point and getopt isn't, and also applying fprintf to a stream in wide-character mode is not allowed. So every single error reporting case has an #ifdef _LIBC block in which it calls internal libc functions instead. The counterpart patch series in glibc makes it possible to simplify all of that down to a set of #defines at the top of the file; core code is written as if it is safe to just call fprintf, flockfile, and funlockfile. (One caveat: it's *not* safe to call any *other* stdio functions.) * lib/getopt.c: When _LIBC is defined, define fprintf to __fxprintf_nocancel, flockfile to _IO_flockfile, and funlockfile to _IO_funlockfile. When neither _LIBC nor _POSIX_THREAD_SAFE_FUNCTIONS is defined, define flockfile and funlockfile as no-ops. (_getopt_internal_r): Remove all internal #ifdef _LIBC blocks; the standalone error-printing code can now be used for libc as well. Add an flockfile/funlockfile pair around one case where the error message is printed in several chunks. Don't use fputc.
Zack Weinberg ae3e58d3 2017-04-06T11:14:13 getopt: fix fencepost error in ambiguous-W-option handling getopt_long contains an undocumented (AFAICT) feature in which, if you put "W;" in the short-options list, then '-W foo' and '-Wfoo' are treated as equivalent to '--foo'. This is implemented with a partial second copy of the code for handling long options, and that code increments optind one too many times when recovering from an ambiguous abbreviated option, which can cause the main loop to walk past the end of argv and crash. I discovered this while writing a test case that tries to exercise all of getopt's error reporting paths; I wouldn't be surprised to learn that this feature is never used by real applications. * lib/getopt.c (_getopt_internal_r): Don't increment d->optind a second time when reporting ambiguous -W options.
Zack Weinberg fbd6c988 2017-04-06T11:14:13 getopt: clean up getopt.c and getopt1.c file headers In getopt.c, there is no need to include wchar.h at all, and it is safe nowadays to assume that stdlib.h does declare getenv (several other gnulib modules make this assumption). In getopt1.c, the #ifdef _LIBC block at the top can be simplified by using "" inclusions consistently, and there is no actual need to include stdlib.h (except in the #ifdef TEST block, where it should be unconditional), nor to provide a backup definition of NULL at all. * lib/getopt1.c: Simplify #ifdeffage at top of file. Move inclusion of stdlib.h to #ifdef TEST block and make unconditional. Do not define NULL. * lib/getopt.c: Don't include wchar.h. No need to declare getenv. * m4/getopt.m4 (gl_PREREQ_GETENV): Delete. * modules/getopt-gnu, modules/getopt-posix: Don't call gl_PREREQ_GETENV.
Zack Weinberg 2dcee3a7 2017-04-06T11:14:13 getopt: harmonize comments with glibc The comments explaining how the behavior of 'getopt' varies depending on whether it's the standalone version and whether there are special characters at the beginning of the options string were inconsistent between gnulib and glibc, and also out of sync with the code. * lib/getopt.c, lib/getopt_int.h: Harmonize comments with glibc.
Zack Weinberg 74a8c9fc 2017-04-06T11:14:13 getopt: remove USE_NONOPTION_FLAGS getopt includes code to parse an environment variable named _XXX_GNU_nonoption_argv_flags_ (where XXX is the current process's PID in decimal); but all of it has been #ifdefed out since 2001, with no official way to turn it back on. According to commentary in glibc's config.h.in, bash version 2.0 set this environment variable to indicate argv elements that were the result of glob expansion and therefore should not be treated as options, but the feature was "disabled later" because "it caused problems". According to bash's CHANGES file, "later" was release 2.01; it gives no more detail about what the problems were. Version 2.0 of bash was released on the last day of 1996, and version 2.01 in June of 1997. Twenty years later, I think it is safe to assume that this environment variable isn't coming back. * lib/getopt_int.h: Remove all #ifdef USE_NONOPTION_FLAGS blocks. * lib/getopt.c: Likewise. Also remove SWAP_FLAGS and the __libc_argc and __libc_argv externs, which were only used by
Zack Weinberg 64abc9c7 2017-04-06T11:14:13 getopt: tabify, in preparation for merge with glibc glibc sticks to the GNU default of indenting with a mix of 8-column tabs and spaces; make the gnulib copy match. getopt.h is not included because it is *not* going to be merged in its present form. * getopt.c, getopt1.c, getopt_int.h: Tabify.
Paul Eggert bd78ca3d 2017-03-22T10:25:04 getopt: merge from glibc This does not change anything substantial; it merely simplifies hypothetical merges back to glibc. * lib/getopt.c, lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h: Change copyright notice to match what is in glibc. * lib/getopt.c: Reorder includes to match glibc. Remove uses of USE_IN_LIBIO. Remove 'register'. In __LIBC code, use __open_memstream rather than open_memstream and __glibc_likely instead of __builtin_expect. * lib/getopt.in.h (__posix_getopt) [!__GETOPT_PREFIX]: New decl.
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Pádraig Brady 4ad02492 2015-02-18T22:37:31 getopt: give accurate ambiguity diagnostic on mem exhaustion * lib/getopt.c (_getopt_internal_r): The previous commit broke out the loop too early, which could give a false indication of ambiguous options under memory exhaustion.
Pádraig Brady 6fa31e52 2015-02-18T02:23:35 getopt: don't crash on memory exhaustion * lib/getopt.c (_getopt_internal_r): Use degraded diagnostics on memory exhaustion. In the _LIBC case we use alloca() as is already done in glibc, so we don't need to consider the separate error path in that awkward case. Also fix a memory leak when ambiguous options are present. Reported by Tobias Stoeckmann
Paul Eggert b9bfe784 2015-01-01T01:38:23 version-etc: new year * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
Eric Blake 1276a2c5 2014-01-01T00:04:40 maint: update copyright I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 9fc81090 2013-01-01T00:50:58 maint: update all copyright year number ranges Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
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