update gnulib

This comes from gnulib 348402f2aac342bc925b7aaea9ee3cc353f427a9 plus
a custom patch to support compilation of arpg in C++11.

* lib/hard-locale.c, lib/hard-locale.h, m4/hard-locale.m4, m4/ltargz.m4:
New files.
* lib/Makefile.am, lib/alloca.in.h, lib/argmatch.c, lib/argmatch.h,
lib/argp-ba.c, lib/argp-eexst.c, lib/argp-fmtstream.c,
lib/argp-fmtstream.h, lib/argp-fs-xinl.c, lib/argp-help.c,
lib/argp-namefrob.h, lib/argp-parse.c, lib/argp-pin.c, lib/argp-pv.c,
lib/argp-pvh.c, lib/argp-xinl.c, lib/argp.h, lib/asnprintf.c,
lib/basename-lgpl.c, lib/c-ctype.h, lib/c-strcase.h, lib/c-strcasecmp.c,
lib/c-strcaseeq.h, lib/c-strncasecmp.c, lib/config.charset,
lib/dirname-lgpl.c, lib/dirname.h, lib/dosname.h, lib/errno.in.h,
lib/error.c, lib/error.h, lib/exitfail.c, lib/exitfail.h,
lib/fcntl.in.h, lib/float+.h, lib/float.c, lib/float.in.h, lib/getopt.c,
lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h, lib/gettext.h,
lib/gettimeofday.c, lib/hard-locale.h, lib/intprops.h, lib/isatty.c,
lib/itold.c, lib/localcharset.c, lib/localcharset.h, lib/lstat.c,
lib/malloc.c, lib/mbrtowc.c, lib/mbsinit.c, lib/memchr.c, lib/mempcpy.c,
lib/mkstemp.c, lib/mkstemps.c, lib/msvc-inval.c, lib/msvc-inval.h,
lib/msvc-nothrow.c, lib/msvc-nothrow.h, lib/pathmax.h,
lib/printf-args.c, lib/printf-args.h, lib/printf-parse.c,
lib/printf-parse.h, lib/progname.c, lib/progname.h, lib/quote.h,
lib/quotearg.c, lib/quotearg.h, lib/rawmemchr.c, lib/ref-add.sin,
lib/ref-del.sin, lib/secure_getenv.c, lib/size_max.h, lib/sleep.c,
lib/stat.c, lib/stdalign.in.h, lib/stdbool.in.h, lib/stddef.in.h,
lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h, lib/stpcpy.c,
lib/strcasecmp.c, lib/strchrnul.c, lib/streq.h, lib/strerror-override.c,
lib/strerror-override.h, lib/strerror.c, lib/string.in.h,
lib/strings.in.h, lib/stripslash.c, lib/strncasecmp.c, lib/strndup.c,
lib/strnlen.c, lib/strverscmp.c, lib/sys_stat.in.h, lib/sys_time.in.h,
lib/sys_types.in.h, lib/sys_wait.in.h, lib/sysexits.in.h,
lib/tempname.c, lib/tempname.h, lib/time.in.h, lib/unistd.in.h,
lib/vasnprintf.c, lib/vasnprintf.h, lib/verify.h, lib/vsnprintf.c,
lib/wchar.in.h, lib/wctype.in.h, lib/xalloc-die.c,
lib/xalloc-oversized.h, lib/xalloc.h, lib/xmalloc.c, lib/xsize.h,
m4/00gnulib.m4, m4/absolute-header.m4, m4/alloca.m4, m4/argp.m4,
m4/codeset.m4, m4/configmake.m4, m4/dirname.m4, m4/double-slash-root.m4,
m4/errno_h.m4, m4/error.m4, m4/exponentd.m4, m4/extensions.m4,
m4/extern-inline.m4, m4/fcntl-o.m4, m4/fcntl_h.m4, m4/float_h.m4,
m4/getopt.m4, m4/gettimeofday.m4, m4/glibc21.m4, m4/gnulib-cache.m4,
m4/gnulib-common.m4, m4/gnulib-comp.m4, m4/gnulib-tool.m4,
m4/include_next.m4, m4/intmax_t.m4, m4/inttypes_h.m4, m4/isatty.m4,
m4/largefile.m4, m4/localcharset.m4, m4/locale-fr.m4, m4/locale-ja.m4,
m4/locale-zh.m4, m4/longlong.m4, m4/lstat.m4, m4/malloc.m4,
m4/math_h.m4, m4/mbrtowc.m4, m4/mbsinit.m4, m4/mbstate_t.m4,
m4/memchr.m4, m4/mempcpy.m4, m4/mkstemp.m4, m4/mkstemps.m4,
m4/mmap-anon.m4, m4/msvc-inval.m4, m4/msvc-nothrow.m4, m4/multiarch.m4,
m4/nocrash.m4, m4/off_t.m4, m4/pathmax.m4, m4/printf.m4, m4/quote.m4,
m4/quotearg.m4, m4/rawmemchr.m4, m4/secure_getenv.m4, m4/size_max.m4,
m4/sleep.m4, m4/ssize_t.m4, m4/stat.m4, m4/stdalign.m4, m4/stdbool.m4,
m4/stddef_h.m4, m4/stdint.m4, m4/stdint_h.m4, m4/stdio_h.m4,
m4/stdlib_h.m4, m4/stpcpy.m4, m4/strcase.m4, m4/strchrnul.m4,
m4/strerror.m4, m4/string_h.m4, m4/strings_h.m4, m4/strndup.m4,
m4/strnlen.m4, m4/strverscmp.m4, m4/sys_socket_h.m4, m4/sys_stat_h.m4,
m4/sys_time_h.m4, m4/sys_types_h.m4, m4/sys_wait_h.m4, m4/sysexits.m4,
m4/tempname.m4, m4/time_h.m4, m4/unistd_h.m4, m4/vasnprintf.m4,
m4/vsnprintf.m4, m4/warn-on-use.m4, m4/wchar_h.m4, m4/wchar_t.m4,
m4/wctype_h.m4, m4/wint_t.m4, m4/xalloc.m4, m4/xsize.m4,
tests/core/randtgba.cc, tools/snippet/arg-nonnull.h,
tools/snippet/c++defs.h, tools/snippet/warn-on-use.h: Update.
This commit is contained in:
Alexandre Duret-Lutz 2016-07-29 10:59:21 +02:00
parent 561672d3d7
commit f6c7ed54c7
218 changed files with 889 additions and 654 deletions

View file

@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# Copyright (C) 2002-2016 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error isatty mkstemp mkstemps progname stpcpy strverscmp sys_wait
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error isatty mkstemp mkstemps progname stpcpy strverscmp sys_wait
AUTOMAKE_OPTIONS = 1.9.6 gnits
@ -346,6 +346,14 @@ EXTRA_libgnu_la_SOURCES += gettimeofday.c
## end gnulib module gettimeofday
## begin gnulib module hard-locale
libgnu_la_SOURCES += hard-locale.c
EXTRA_DIST += hard-locale.h
## end gnulib module hard-locale
## begin gnulib module intprops

View file

@ -1,6 +1,6 @@
/* Memory allocation on the stack.
Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation,
Copyright (C) 1995, 1999, 2001-2004, 2006-2016 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify it

View file

@ -1,6 +1,6 @@
/* argmatch.c -- find a match for a string in an array
Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2015 Free Software
Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2016 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* argmatch.h -- definitions and prototypes for argmatch.c
Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2015 Free Software
Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2016 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
Copyright (C) 1996-1997, 1999, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,5 +1,5 @@
/* Default definition for ARGP_ERR_EXIT_STATUS
Copyright (C) 1997, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1997, 2009-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,6 +1,5 @@
/* Word-wrapping and line-truncating streams
Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2015 Free Software
Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -39,7 +38,7 @@
#define isblank(ch) ((ch)==' ' || (ch)=='\t')
#endif
#if defined _LIBC && defined USE_IN_LIBIO
#ifdef _LIBC
# include <wchar.h>
# include <libio/libioP.h>
# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
@ -100,7 +99,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
__argp_fmtstream_update (fs);
if (fs->p > fs->buf)
{
#ifdef USE_IN_LIBIO
#ifdef _LIBC
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
#else
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
@ -149,7 +148,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
size_t i;
for (i = 0; i < pad; i++)
{
#ifdef USE_IN_LIBIO
#ifdef _LIBC
if (_IO_fwide (fs->stream, 0) > 0)
putwc_unlocked (L' ', fs->stream);
else
@ -315,7 +314,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
*nl++ = ' ';
else
for (i = 0; i < fs->wmargin; ++i)
#ifdef USE_IN_LIBIO
#ifdef _LIBC
if (_IO_fwide (fs->stream, 0) > 0)
putwc_unlocked (L' ', fs->stream);
else

View file

@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams.
Copyright (C) 1997, 2006-2015 Free Software Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -40,8 +40,7 @@
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
|| (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
#if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
/* line_wrap_stream is available, so use that. */
#define ARGP_FMTSTREAM_USE_LINEWRAP
#endif
@ -87,6 +86,7 @@ typedef FILE *argp_fmtstream_t;
#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
/* Guess we have to define our own version. */
struct argp_fmtstream
{
@ -207,63 +207,11 @@ _GL_INLINE_HEADER_BEGIN
#endif
#ifndef ARGP_FS_EI
# ifdef __GNUC__
/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
inline semantics, unless -fgnu89-inline is used. It defines a macro
__GNUC_STDC_INLINE__ to indicate this situation or a macro
__GNUC_GNU_INLINE__ to indicate the opposite situation.
GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
semantics but warns, unless -fgnu89-inline is used:
warning: C99 inline functions are not supported; using GNU89
warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.
Whereas Apple GCC 4.0.1 build 5479 without -std=c99 or -std=gnu99
implements the GNU C inline semantics and defines the macro
__GNUC_GNU_INLINE__, but it does not warn and does not support
__attribute__ ((__gnu_inline__)).
All in all, these are the possible combinations. For every compiler,
we need to choose ARGP_FS_EI so that the corresponding table cell
contains an "ok".
\ ARGP_FS_EI inline extern extern
\ inline inline
CC \ __attribute__
((gnu_inline))
gcc 4.3.0 error ok ok
gcc 4.3.0 -std=gnu99 -fgnu89-inline error ok ok
gcc 4.3.0 -std=gnu99 ok error ok
gcc 4.2.2 error ok ok
gcc 4.2.2 -std=gnu99 -fgnu89-inline error ok ok
gcc 4.2.2 -std=gnu99 error warning ok
gcc 4.1.2 error ok warning
gcc 4.1.2 -std=gnu99 error ok warning
Apple gcc 4.0.1 error ok warning
Apple gcc 4.0.1 -std=gnu99 ok error warning
*/
# if defined __GNUC_STDC_INLINE__
# define ARGP_FS_EI inline
# elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
# define ARGP_FS_EI extern inline __attribute__ ((__gnu_inline__))
# else
# define ARGP_FS_EI extern inline
# endif
# else
/* With other compilers, assume the ISO C99 meaning of 'inline', if
the compiler supports 'inline' at all. */
# define ARGP_FS_EI inline
# endif
#define ARGP_FS_EI extern inline
#endif
ARGP_FS_EI size_t
__argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len)
__argp_fmtstream_write (argp_fmtstream_t __fs, const char *__str, size_t __len)
{
if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
{

View file

@ -1,5 +1,5 @@
/* Real definitions for extern inline functions in argp-fmtstream.h
Copyright (C) 1997, 2003-2004, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,5 +1,5 @@
/* Hierarchical argument parsing help output
Copyright (C) 1995-2005, 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -26,15 +26,16 @@
#include <alloca.h>
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
#ifdef USE_IN_LIBIO
#ifdef _LIBC
# include <../libio/libioP.h>
# include <wchar.h>
#endif
@ -42,7 +43,7 @@
# include <libintl.h>
# undef dgettext
# define dgettext(domain, msgid) \
INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
__dcgettext (domain, msgid, LC_MESSAGES)
#else
# include "gettext.h"
#endif
@ -104,39 +105,38 @@ struct uparams
static struct uparams uparams = {
DUP_ARGS, DUP_ARGS_NOTE,
SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
USAGE_INDENT, RMARGIN,
0
USAGE_INDENT, RMARGIN
};
/* A particular uparam, and what the user name is. */
struct uparam_name
{
const char *name; /* User name. */
int is_bool; /* Whether it's 'boolean'. */
size_t uparams_offs; /* Location of the (int) field in UPARAMS. */
const char name[14]; /* User name. */
bool is_bool; /* Whether it's 'boolean'. */
unsigned char uparams_offs; /* Location of the (int) field in UPARAMS. */
};
/* The name-field mappings we know about. */
static const struct uparam_name uparam_names[] =
{
{ "dup-args", 1, offsetof (struct uparams, dup_args) },
{ "dup-args-note", 1, offsetof (struct uparams, dup_args_note) },
{ "short-opt-col", 0, offsetof (struct uparams, short_opt_col) },
{ "long-opt-col", 0, offsetof (struct uparams, long_opt_col) },
{ "doc-opt-col", 0, offsetof (struct uparams, doc_opt_col) },
{ "opt-doc-col", 0, offsetof (struct uparams, opt_doc_col) },
{ "header-col", 0, offsetof (struct uparams, header_col) },
{ "usage-indent", 0, offsetof (struct uparams, usage_indent) },
{ "rmargin", 0, offsetof (struct uparams, rmargin) },
{ 0 }
{ "dup-args", true, offsetof (struct uparams, dup_args) },
{ "dup-args-note", true, offsetof (struct uparams, dup_args_note) },
{ "short-opt-col", false, offsetof (struct uparams, short_opt_col) },
{ "long-opt-col", false, offsetof (struct uparams, long_opt_col) },
{ "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) },
{ "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) },
{ "header-col", false, offsetof (struct uparams, header_col) },
{ "usage-indent", false, offsetof (struct uparams, usage_indent) },
{ "rmargin", false, offsetof (struct uparams, rmargin) }
};
#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
static void
validate_uparams (const struct argp_state *state, struct uparams *upptr)
{
const struct uparam_name *up;
for (up = uparam_names; up->name; up++)
for (up = uparam_names; up < uparam_names + nuparam_names; up++)
{
if (up->is_bool
|| up->uparams_offs == offsetof (struct uparams, rmargin))
@ -155,7 +155,7 @@ ARGP_HELP_FMT: %s value is less than or equal to %s"),
uparams.valid = 1;
}
/* Read user options from the environment, and fill in UPARAMS appropriately. */
/* Read user options from the environment, and fill in UPARAMS appropriately. */
static void
fill_in_uparams (const struct argp_state *state)
{
@ -211,29 +211,27 @@ fill_in_uparams (const struct argp_state *state)
SKIPWS (arg);
}
for (un = uparam_names; un->name; un++)
for (un = uparam_names;
un < uparam_names + nuparam_names;
un++)
if (strlen (un->name) == var_len
&& strncmp (var, un->name, var_len) == 0)
{
if (unspec && !un->is_bool)
__argp_failure (state, 0, 0,
dgettext (state->root_argp->argp_domain,
dgettext (state == NULL ? NULL
: state->root_argp->argp_domain,
"\
%.*s: ARGP_HELP_FMT parameter requires a value"),
(int) var_len, var);
else if (val < 0)
__argp_failure (state, 0, 0,
dgettext (state->root_argp->argp_domain,
"\
%.*s: ARGP_HELP_FMT parameter must be positive"),
(int) var_len, var);
else
*(int *)((char *)&new_params + un->uparams_offs) = val;
break;
}
if (! un->name)
if (un == uparam_names + nuparam_names)
__argp_failure (state, 0, 0,
dgettext (state->root_argp->argp_domain, "\
dgettext (state == NULL ? NULL
: state->root_argp->argp_domain, "\
%.*s: Unknown ARGP_HELP_FMT parameter"),
(int) var_len, var);
@ -244,7 +242,8 @@ fill_in_uparams (const struct argp_state *state)
else if (*var)
{
__argp_failure (state, 0, 0,
dgettext (state->root_argp->argp_domain,
dgettext (state == NULL ? NULL
: state->root_argp->argp_domain,
"Garbage in ARGP_HELP_FMT: %s"), var);
break;
}
@ -678,9 +677,7 @@ static int
hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
{
/* If one cluster is deeper than the other, use its ancestor at the same
level, so that finding the common ancestor is straightforward.
clN->depth > 0 means that clN->parent != NULL (see hol_add_cluster) */
level, so that finding the common ancestor is straightforward. */
while (cl1->depth > cl2->depth)
cl1 = cl1->parent;
while (cl2->depth > cl1->depth)
@ -721,20 +718,14 @@ static int
canon_doc_option (const char **name)
{
int non_opt;
if (!*name)
non_opt = 1;
else
{
/* Skip initial whitespace. */
while (isspace ((unsigned char) **name))
(*name)++;
/* Decide whether this looks like an option (leading '-') or not. */
non_opt = (**name != '-');
/* Skip until part of name used for sorting. */
while (**name && !isalnum ((unsigned char) **name))
(*name)++;
}
/* Skip initial whitespace. */
while (isspace (**name))
(*name)++;
/* Decide whether this looks like an option (leading '-') or not. */
non_opt = (**name != '-');
/* Skip until part of name used for sorting. */
while (**name && !isalnum (**name))
(*name)++;
return non_opt;
}
@ -749,25 +740,23 @@ hol_entry_cmp (const struct hol_entry *entry1,
/* The group numbers by which the entries should be ordered; if either is
in a cluster, then this is just the group within the cluster. */
int group1 = entry1->group, group2 = entry2->group;
int rc;
if (entry1->cluster != entry2->cluster)
{
/* The entries are not within the same cluster, so we can't compare them
directly, we have to use the appropriate clustering level too. */
if (! entry1->cluster)
/* ENTRY1 is at the "base level", not in a cluster, so we have to
/* ENTRY1 is at the 'base level', not in a cluster, so we have to
compare it's group number with that of the base cluster in which
ENTRY2 resides. Note that if they're in the same group, the
clustered option always comes laster. */
clustered option always comes last. */
return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
else if (! entry2->cluster)
/* Likewise, but ENTRY2's not in a cluster. */
return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
else
/* Both entries are in clusters, we can just compare the clusters. */
return (rc = hol_cluster_cmp (entry1->cluster, entry2->cluster)) ?
rc : HOL_ENTRY_PTRCMP (entry1, entry2);
return hol_cluster_cmp (entry1->cluster, entry2->cluster);
}
else if (group1 == group2)
/* The entries are both in the same cluster and group, so compare them
@ -781,18 +770,17 @@ hol_entry_cmp (const struct hol_entry *entry1,
const char *long2 = hol_entry_first_long (entry2);
if (doc1)
doc1 = canon_doc_option (&long1);
doc1 = long1 != NULL && canon_doc_option (&long1);
if (doc2)
doc2 = canon_doc_option (&long2);
doc2 = long2 != NULL && canon_doc_option (&long2);
if (doc1 != doc2)
/* "documentation" options always follow normal options (or
/* 'documentation' options always follow normal options (or
documentation options that *look* like normal options). */
return doc1 - doc2;
else if (!short1 && !short2 && long1 && long2)
/* Only long options. */
return (rc = __strcasecmp (long1, long2)) ?
rc : HOL_ENTRY_PTRCMP (entry1, entry2);
return __strcasecmp (long1, long2);
else
/* Compare short/short, long/short, short/long, using the first
character of long options. Entries without *any* valid
@ -800,22 +788,22 @@ hol_entry_cmp (const struct hol_entry *entry1,
first, but as they're not displayed, it doesn't matter where
they are. */
{
unsigned char first1 = short1 ? short1 : long1 ? *long1 : 0;
unsigned char first2 = short2 ? short2 : long2 ? *long2 : 0;
/* Use tolower, not _tolower, since only the former is
guaranteed to work on something already lower case. */
char first1 = short1 ? short1 : long1 ? *long1 : 0;
char first2 = short2 ? short2 : long2 ? *long2 : 0;
#ifdef _tolower
int lower_cmp = _tolower (first1) - _tolower (first2);
#else
int lower_cmp = tolower (first1) - tolower (first2);
#endif
/* Compare ignoring case, except when the options are both the
same letter, in which case lower-case always comes first. */
return lower_cmp ? lower_cmp :
(rc = first2 - first1) ?
rc : HOL_ENTRY_PTRCMP (entry1, entry2);
return lower_cmp ? lower_cmp : first2 - first1;
}
}
else
/* Within the same cluster, but not the same group, so just compare
groups. */
return group_cmp (group1, group2, HOL_ENTRY_PTRCMP (entry1, entry2));
return group_cmp (group1, group2, 0);
}
/* Version of hol_entry_cmp with correct signature for qsort. */
@ -892,8 +880,7 @@ hol_append (struct hol *hol, struct hol *more)
/* Fix up the short options pointers from HOL. */
for (e = entries, left = hol->num_entries; left > 0; e++, left--)
e->short_options =
short_options + (e->short_options - hol->short_options);
e->short_options += (short_options - hol->short_options);
/* Now add the short options from MORE, fixing up its entries
too. */
@ -1013,7 +1000,7 @@ static const char *
filter_doc (const char *doc, int key, const struct argp *argp,
const struct argp_state *state)
{
if (argp->help_filter)
if (argp && argp->help_filter)
/* We must apply a user filter to this output. */
{
void *input = __argp_input (argp, state);
@ -1109,13 +1096,7 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
int old_wm = __argp_fmtstream_wmargin (stream);
/* PEST is a state block holding some of our variables that we'd like to
share with helper functions. */
struct pentry_state pest;
pest.entry = entry;
pest.stream = stream;
pest.hhstate = hhstate;
pest.first = 1;
pest.state = state;
struct pentry_state pest = { entry, stream, hhstate, 1, state };
if (! odoc (real))
for (opt = real, num = entry->num; num > 0; opt++, num--)
@ -1137,7 +1118,9 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
__argp_fmtstream_putc (stream, '-');
__argp_fmtstream_putc (stream, *so);
if (!have_long_opt || uparams.dup_args)
arg (real, " %s", "[%s]", state->root_argp->argp_domain, stream);
arg (real, " %s", "[%s]",
state == NULL ? NULL : state->root_argp->argp_domain,
stream);
else if (real->arg)
hhstate->suppressed_dup_arg = 1;
}
@ -1150,35 +1133,29 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
{
__argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
for (opt = real, num = entry->num; num > 0; opt++, num--)
if (opt->name && *opt->name && ovisible (opt))
if (opt->name && ovisible (opt))
{
comma (uparams.doc_opt_col, &pest);
/* Calling dgettext here isn't quite right, since sorting will
have been done on the original; but documentation options
should be pretty rare anyway... */
__argp_fmtstream_puts (stream,
onotrans (opt) ?
opt->name :
dgettext (state->root_argp->argp_domain,
dgettext (state == NULL ? NULL
: state->root_argp->argp_domain,
opt->name));
}
}
else
/* A real long option. */
{
int first_long_opt = 1;
__argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
for (opt = real, num = entry->num; num > 0; opt++, num--)
if (opt->name && ovisible (opt))
{
comma (uparams.long_opt_col, &pest);
__argp_fmtstream_printf (stream, "--%s", opt->name);
if (first_long_opt || uparams.dup_args)
arg (real, "=%s", "[=%s]", state->root_argp->argp_domain,
stream);
else if (real->arg)
hhstate->suppressed_dup_arg = 1;
arg (real, "=%s", "[=%s]",
state == NULL ? NULL : state->root_argp->argp_domain, stream);
}
}
@ -1197,7 +1174,8 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
}
else
{
const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain,
const char *tstr = real->doc ? dgettext (state == NULL ? NULL
: state->root_argp->argp_domain,
real->doc) : 0;
const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
if (fstr && *fstr)
@ -1245,7 +1223,8 @@ hol_help (struct hol *hol, const struct argp_state *state,
if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
{
const char *tstr = dgettext (state->root_argp->argp_domain, "\
const char *tstr = dgettext (state == NULL ? NULL
: state->root_argp->argp_domain, "\
Mandatory or optional arguments to long options are also mandatory or \
optional for any corresponding short options.");
const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
@ -1323,7 +1302,7 @@ usage_long_opt (const struct argp_option *opt,
if (! arg)
arg = real->arg;
if (! (flags & OPTION_NO_USAGE) && !odoc (opt))
if (! (flags & OPTION_NO_USAGE))
{
if (arg)
{
@ -1440,7 +1419,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
const char *cp = fdoc;
nl = __strchrnul (cp, '\n');
if (*nl != '\0')
/* This is a "multi-level" args doc; advance to the correct position
/* This is a 'multi-level' args doc; advance to the correct position
as determined by our state in LEVELS, and update LEVELS. */
{
int i;
@ -1481,7 +1460,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
}
/* Print the documentation for ARGP to STREAM; if POST is false, then
everything preceding a '\v' character in the documentation strings (or
everything preceeding a '\v' character in the documentation strings (or
the whole string, for those with none) is printed, otherwise, everything
following the '\v' character (nothing for strings without). Each separate
bit of documentation is separated a blank line, and if PRE_BLANK is true,
@ -1494,55 +1473,46 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
{
const char *text;
const char *inp_text;
size_t inp_text_len = 0;
const char *trans_text;
void *input = 0;
int anything = 0;
size_t inp_text_limit = 0;
const char *doc = dgettext (argp->argp_domain, argp->doc);
const struct argp_child *child = argp->children;
if (argp->doc)
if (doc)
{
char *vt = strchr (argp->doc, '\v');
if (vt)
{
if (post)
{
inp_text = vt + 1;
if (! *inp_text)
inp_text = 0;
}
else
{
inp_text_len = vt - argp->doc;
inp_text = inp_text_len ? __strndup (argp->doc, inp_text_len) : 0;
}
}
else
inp_text = post ? 0 : argp->doc;
trans_text = inp_text ? dgettext (argp->argp_domain, inp_text) : NULL;
char *vt = strchr (doc, '\v');
inp_text = post ? (vt ? vt + 1 : 0) : doc;
inp_text_limit = (!post && vt) ? (vt - doc) : 0;
}
else
trans_text = inp_text = 0;
inp_text = 0;
if (argp->help_filter)
/* We have to filter the doc strings. */
{
if (inp_text_limit)
/* Copy INP_TEXT so that it's nul-terminated. */
inp_text = __strndup (inp_text, inp_text_limit);
input = __argp_input (argp, state);
text =
(*argp->help_filter) (post
? ARGP_KEY_HELP_POST_DOC
: ARGP_KEY_HELP_PRE_DOC,
trans_text, input);
inp_text, input);
}
else
text = (const char *) trans_text;
text = (const char *) inp_text;
if (text)
{
if (pre_blank)
__argp_fmtstream_putc (stream, '\n');
__argp_fmtstream_puts (stream, text);
if (text == inp_text && inp_text_limit)
__argp_fmtstream_write (stream, inp_text, inp_text_limit);
else
__argp_fmtstream_puts (stream, text);
if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream))
__argp_fmtstream_putc (stream, '\n');
@ -1550,14 +1520,13 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
anything = 1;
}
if (text && text != trans_text)
if (text && text != inp_text)
free ((char *) text); /* Free TEXT returned from the help filter. */
if (inp_text && inp_text_len)
if (inp_text && inp_text_limit && argp->help_filter)
free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */
if (post && argp->help_filter)
/* Now see if we have to output an ARGP_KEY_HELP_EXTRA text. */
/* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
{
text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
if (text)
@ -1584,8 +1553,8 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
}
/* Output a usage message for ARGP to STREAM. If called from
argp_state_help, STATE is the relevant parsing state. FLAGS are from the
set ARGP_HELP_*. NAME is what to use wherever a "program name" is
argp_state_help, STATE is the relevent parsing state. FLAGS are from the
set ARGP_HELP_*. NAME is what to use wherever a 'program name' is
needed. */
static void
_help (const struct argp *argp, const struct argp_state *state, FILE *stream,
@ -1729,14 +1698,11 @@ Try '%s --help' or '%s --usage' for more information.\n"),
}
/* Output a usage message for ARGP to STREAM. FLAGS are from the set
ARGP_HELP_*. NAME is what to use wherever a "program name" is needed. */
ARGP_HELP_*. NAME is what to use wherever a 'program name' is needed. */
void __argp_help (const struct argp *argp, FILE *stream,
unsigned flags, char *name)
{
struct argp_state state;
memset (&state, 0, sizeof state);
state.root_argp = argp;
_help (argp, &state, stream, flags, name);
_help (argp, 0, stream, flags, name);
}
#ifdef weak_alias
weak_alias (__argp_help, argp_help)
@ -1747,7 +1713,8 @@ char *
__argp_short_program_name (void)
{
# if HAVE_DECL_PROGRAM_INVOCATION_NAME
return __argp_base_name (program_invocation_name);
char *name = strrchr (program_invocation_name, '/');
return name ? name + 1 : program_invocation_name;
# else
/* FIXME: What now? Miles suggests that it is better to use NULL,
but currently the value is passed on directly to fputs_unlocked,
@ -1806,33 +1773,26 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
va_start (ap, fmt);
#ifdef USE_IN_LIBIO
if (_IO_fwide (stream, 0) > 0)
{
char *buf;
#ifdef _LIBC
char *buf;
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;
if (_IO_vasprintf (&buf, fmt, ap) < 0)
buf = NULL;
__fwprintf (stream, L"%s: %s\n",
state ? state->name : __argp_short_program_name (),
buf);
__fxprintf (stream, "%s: %s\n",
state ? state->name : __argp_short_program_name (), buf);
free (buf);
}
else
free (buf);
#else
fputs_unlocked (state ? state->name : __argp_short_program_name (),
stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
vfprintf (stream, fmt, ap);
putc_unlocked ('\n', stream);
#endif
{
fputs_unlocked (state
? state->name : __argp_short_program_name (),
stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
vfprintf (stream, fmt, ap);
putc_unlocked ('\n', stream);
}
__argp_state_help (state, stream, ARGP_HELP_STD_ERR);
@ -1870,41 +1830,34 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
__flockfile (stream);
#endif
#ifdef USE_IN_LIBIO
if (_IO_fwide (stream, 0) > 0)
__fwprintf (stream, L"%s",
state ? state->name : __argp_short_program_name ());
else
#ifdef _LIBC
__fxprintf (stream, "%s",
state ? state->name : __argp_short_program_name ());
#else
fputs_unlocked (state ? state->name : __argp_short_program_name (),
stream);
#endif
fputs_unlocked (state
? state->name : __argp_short_program_name (),
stream);
if (fmt)
{
va_list ap;
va_start (ap, fmt);
#ifdef USE_IN_LIBIO
if (_IO_fwide (stream, 0) > 0)
{
char *buf;
#ifdef _LIBC
char *buf;
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;
if (_IO_vasprintf (&buf, fmt, ap) < 0)
buf = NULL;
__fwprintf (stream, L": %s", buf);
__fxprintf (stream, ": %s", buf);
free (buf);
}
else
free (buf);
#else
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
vfprintf (stream, fmt, ap);
#endif
{
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
vfprintf (stream, fmt, ap);
}
va_end (ap);
}
@ -1913,32 +1866,29 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
{
char buf[200];
#ifdef USE_IN_LIBIO
if (_IO_fwide (stream, 0) > 0)
__fwprintf (stream, L": %s",
__strerror_r (errnum, buf, sizeof (buf)));
else
#ifdef _LIBC
__fxprintf (stream, ": %s",
__strerror_r (errnum, buf, sizeof (buf)));
#else
char const *s = NULL;
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
# if HAVE_DECL_STRERROR_R
# if STRERROR_R_CHAR_P
s = __strerror_r (errnum, buf, sizeof buf);
# else
if (__strerror_r (errnum, buf, sizeof buf) == 0)
s = buf;
# endif
# endif
if (! s && ! (s = strerror (errnum)))
s = dgettext (state->root_argp->argp_domain,
"Unknown system error");
fputs_unlocked (s, stream);
#endif
{
char const *s = NULL;
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
#if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P && !defined strerror_r)
s = __strerror_r (errnum, buf, sizeof buf);
#elif HAVE_DECL_STRERROR_R
if (__strerror_r (errnum, buf, sizeof buf) == 0)
s = buf;
#endif
#if !_LIBC
if (! s && ! (s = strerror (errnum)))
s = dgettext (state->root_argp->argp_domain,
"Unknown system error");
#endif
fputs (s, stream);
}
}
#ifdef USE_IN_LIBIO
#if _LIBC
if (_IO_fwide (stream, 0) > 0)
putwc_unlocked (L'\n', stream);
else

View file

@ -1,5 +1,5 @@
/* Name frobnication for compiling argp outside of glibc
Copyright (C) 1997, 2003, 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -138,7 +138,7 @@
#endif /* !_LIBC */
#ifndef __set_errno
# define __set_errno(e) (errno = (e))
#define __set_errno(e) (errno = (e))
#endif
#if defined GNULIB_ARGP_DISABLE_DIRNAME

View file

@ -1,5 +1,5 @@
/* Hierarchical argument parsing, layered over getopt
Copyright (C) 1995-2000, 2002-2004, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -34,7 +34,7 @@
# include <libintl.h>
# undef dgettext
# define dgettext(domain, msgid) \
INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
__dcgettext (domain, msgid, LC_MESSAGES)
#else
# include "gettext.h"
#endif
@ -80,9 +80,10 @@ static const struct argp_option argp_default_options[] =
{
{"help", '?', 0, 0, N_("give this help list"), -1},
{"usage", OPT_USAGE, 0, 0, N_("give a short usage message"), 0},
{"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("set the program name"), 0},
{"program-name",OPT_PROGNAME, N_("NAME"), OPTION_HIDDEN,
N_("set the program name"), 0},
{"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
N_("hang for SECS seconds (default 3600)"), 0},
N_("hang for SECS seconds (default 3600)"), 0},
{NULL, 0, 0, 0, NULL, 0}
};

View file

@ -1,5 +1,5 @@
/* Full and short program names for argp module
Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2005, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION.
Copyright (C) 1996-1997, 1999, 2006, 2009-2015 Free Software Foundation,
Inc.
Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,6 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
Copyright (C) 1996-1997, 1999, 2004, 2009-2015 Free Software Foundation,
Inc.
Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,5 +1,5 @@
/* Real definitions for extern inline functions in argp.h
Copyright (C) 1997-1998, 2004, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.

View file

@ -1,5 +1,5 @@
/* Hierarchical argument parsing, layered over getopt.
Copyright (C) 1995-1999, 2003-2015 Free Software Foundation, Inc.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -146,15 +146,14 @@ struct argp_option
/* Valid only in conjunction with OPTION_DOC. This option disables translation
of option name. */
#define OPTION_NO_TRANS 0x20
struct argp; /* fwd declare this type */
struct argp_state; /* " */
struct argp_child; /* " */
/* The type of a pointer to an argp parsing function. */
typedef error_t (*argp_parser_t) (int key, char *arg,
struct argp_state *state);
typedef error_t (*argp_parser_t) (int __key, char *__arg,
struct argp_state *__state);
/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
returns will simply be ignored. For user keys, this error will be turned
@ -589,28 +588,7 @@ _GL_INLINE_HEADER_BEGIN
# endif
# ifndef ARGP_EI
# ifdef __GNUC__
/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
inline semantics, unless -fgnu89-inline is used. It defines a macro
__GNUC_STDC_INLINE__ to indicate this situation or a macro
__GNUC_GNU_INLINE__ to indicate the opposite situation.
GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
semantics but warns, unless -fgnu89-inline is used:
warning: C99 inline functions are not supported; using GNU89
warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
# if defined __GNUC_STDC_INLINE__
# define ARGP_EI __inline__
# elif defined __GNUC_GNU_INLINE__
# define ARGP_EI extern __inline__ __attribute__ ((__gnu_inline__))
# else
# define ARGP_EI extern __inline__
# endif
# else
/* With other compilers, assume the ISO C99 meaning of 'inline', if
the compiler supports 'inline' at all. */
# define ARGP_EI inline
# endif
# define ARGP_EI __extern_inline
# endif
ARGP_EI void

View file

@ -1,5 +1,5 @@
/* Formatted output to strings.
Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1999, 2002, 2006, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2016 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -5,7 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2000-2003, 2006, 2008-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Case-insensitive string comparison functions in C locale.
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Optimized case-insensitive string comparison in C locale.
Copyright (C) 2001-2002, 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published

View file

@ -1,5 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
# Copyright (C) 2000-2004, 2006-2015 Free Software Foundation, Inc.
# Copyright (C) 2000-2004, 2006-2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2016 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Take file names apart into directory and base names.
Copyright (C) 1998, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Copyright (C) 1998, 2001, 2003-2006, 2009-2016 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* File names on MS-DOS/Windows systems.
Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2000-2001, 2004-2006, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A POSIX-like <errno.h>.
Copyright (C) 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2008-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
Copyright (C) 1990-1998, 2000-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Declaration for error-reporting function
Copyright (C) 1995-1997, 2003, 2006, 2008-2015 Free Software Foundation,
Copyright (C) 1995-1997, 2003, 2006, 2008-2016 Free Software Foundation,
Inc.
This file is part of the GNU C Library.

View file

@ -1,6 +1,6 @@
/* Failure exit status
Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2002-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* Failure exit status
Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2002, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* Like <fcntl.h>, but with non-working flags defined to 0.
Copyright (C) 2006-2015 Free Software Foundation, Inc.
Copyright (C) 2006-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Supplemental information about the floating-point formats.
Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Auxiliary definitions for <float.h>.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* A correct <float.h>.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -2,7 +2,7 @@
NOTE: getopt is part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2015 Free Software
Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2016 Free Software
Foundation, Inc.
This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2016 Free Software
Foundation, Inc.
This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software
Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2016 Free Software
Foundation, Inc.
This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Internal declarations for getopt.
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2016 Free Software
Foundation, Inc.
This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@ -225,15 +225,17 @@ dcpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcgettext (domain, msg_ctxt_id, category);
found_translation = (translation != msg_ctxt_id);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
if (translation != msg_ctxt_id)
if (found_translation)
return translation;
}
return msgid;
@ -271,15 +273,17 @@ dcnpgettext_expr (const char *domain,
if (msg_ctxt_id != NULL)
#endif
{
int found_translation;
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
msg_ctxt_id[msgctxt_len - 1] = '\004';
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
#endif
if (!(translation == msg_ctxt_id || translation == msgid_plural))
if (found_translation)
return translation;
}
return (n == 1 ? msgid : msgid_plural);

View file

@ -1,6 +1,6 @@
/* Provide gettimeofday for systems that don't have it or for which it's broken.
Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2003, 2005-2007, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

72
lib/hard-locale.c Normal file
View file

@ -0,0 +1,72 @@
/* hard-locale.c -- Determine whether a locale is hard.
Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2016 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "hard-locale.h"
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#ifdef __GLIBC__
# define GLIBC_VERSION __GLIBC__
#elif defined __UCLIBC__
# define GLIBC_VERSION 2
#else
# define GLIBC_VERSION 0
#endif
/* Return true if the current CATEGORY locale is hard, i.e. if you
can't get away with assuming traditional C or POSIX behavior. */
bool
hard_locale (int category)
{
bool hard = true;
char const *p = setlocale (category, NULL);
if (p)
{
if (2 <= GLIBC_VERSION)
{
if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0)
hard = false;
}
else
{
char *locale = strdup (p);
if (locale)
{
/* Temporarily set the locale to the "C" and "POSIX" locales
to find their names, so that we can determine whether one
or the other is the caller's locale. */
if (((p = setlocale (category, "C"))
&& strcmp (p, locale) == 0)
|| ((p = setlocale (category, "POSIX"))
&& strcmp (p, locale) == 0))
hard = false;
/* Restore the caller's locale. */
setlocale (category, locale);
free (locale);
}
}
}
return hard;
}

25
lib/hard-locale.h Normal file
View file

@ -0,0 +1,25 @@
/* Determine whether a locale is hard.
Copyright (C) 1999, 2003-2004, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef HARD_LOCALE_H_
# define HARD_LOCALE_H_ 1
# include <stdbool.h>
bool hard_locale (int);
#endif /* HARD_LOCALE_H_ */

View file

@ -1,10 +1,10 @@
/* intprops.h -- properties of integer types
Copyright (C) 2001-2005, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -21,9 +21,9 @@
#define _GL_INTPROPS_H
#include <limits.h>
#include <verify.h>
/* Return an integer value, converted to the same type as the integer
expression E after integer type promotion. V is the unconverted value. */
/* Return a value with the common real type of E and V and the value of V. */
#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
@ -37,37 +37,18 @@
an integer. */
#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
/* True if negative values of the signed integer type T use two's
complement, ones' complement, or signed magnitude representation,
respectively. Much GNU code assumes two's complement, but some
people like to be portable to all possible C hosts. */
#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
/* True if the signed integer expression E uses two's complement. */
#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
/* True if the arithmetic type T is signed. */
/* True if the real type T is signed. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* Return 1 if the integer expression E, after integer promotion, has
a signed type. */
#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
/* Return 1 if the real expression E, after promotion, has a
signed or floating type. */
#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
/* Minimum and maximum values for integer types and expressions. These
macros have undefined behavior if T is signed and has padding bits.
If this is a problem for you, please let us know how to fix it for
your host. */
/* Minimum and maximum values for integer types and expressions. */
/* The maximum and minimum values for the integer type T. */
#define TYPE_MINIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) 0 \
: TYPE_SIGNED_MAGNITUDE (t) \
? ~ (t) 0 \
: ~ TYPE_MAXIMUM (t)))
#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
#define TYPE_MAXIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) -1 \
@ -76,18 +57,35 @@
/* The maximum and minimum values for the type of the expression E,
after integer promotion. E should not have side effects. */
#define _GL_INT_MINIMUM(e) \
(_GL_INT_SIGNED (e) \
? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \
(EXPR_SIGNED (e) \
? ~ _GL_SIGNED_INT_MAXIMUM (e) \
: _GL_INT_CONVERT (e, 0))
#define _GL_INT_MAXIMUM(e) \
(_GL_INT_SIGNED (e) \
(EXPR_SIGNED (e) \
? _GL_SIGNED_INT_MAXIMUM (e) \
: _GL_INT_NEGATE_CONVERT (e, 1))
#define _GL_SIGNED_INT_MAXIMUM(e) \
(((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
/* This include file assumes that signed types are two's complement without
padding bits; the above macros have undefined behavior otherwise.
If this is a problem for you, please let us know how to fix it for your host.
As a sanity check, test the assumption for some signed types that
<limits.h> bounds. */
verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
verify (TYPE_MINIMUM (short int) == SHRT_MIN);
verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
verify (TYPE_MINIMUM (int) == INT_MIN);
verify (TYPE_MAXIMUM (int) == INT_MAX);
verify (TYPE_MINIMUM (long int) == LONG_MIN);
verify (TYPE_MAXIMUM (long int) == LONG_MAX);
#ifdef LLONG_MAX
verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
#endif
/* Return 1 if the __typeof__ keyword works. This could be done by
/* Does the __typeof__ keyword work? This could be done by
'configure', but for now it's easier to do it by hand. */
#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
|| (0x5110 <= __SUNPRO_C && !__STDC__))
@ -224,24 +222,35 @@
? (a) < (min) >> (b) \
: (max) >> (b) < (a))
/* True if __builtin_add_overflow (A, B, P) works when P is null. */
#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC__)
/* The _GL*_OVERFLOW macros have the same restrictions as the
*_RANGE_OVERFLOW macros, except that they do not assume that operands
(e.g., A and B) have the same type as MIN and MAX. Instead, they assume
that the result (e.g., A + B) has that type. */
#define _GL_ADD_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
: (a) < 0 ? (b) <= (a) + (b) \
: (b) < 0 ? (a) <= (a) + (b) \
: (a) + (b) < (b))
#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
: (a) < 0 ? 1 \
: (b) < 0 ? (a) - (b) <= (a) \
: (a) < (b))
#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
(((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
|| INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
# define _GL_ADD_OVERFLOW(a, b, min, max)
__builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)
__builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0)
# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)
__builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0)
#else
# define _GL_ADD_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
: (a) < 0 ? (b) <= (a) + (b) \
: (b) < 0 ? (a) <= (a) + (b) \
: (a) + (b) < (b))
# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
: (a) < 0 ? 1 \
: (b) < 0 ? (a) - (b) <= (a) \
: (a) < (b))
# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
(((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
|| INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
#endif
#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
: (a) < 0 ? (b) <= (a) + (b) - 1 \
@ -273,9 +282,10 @@
Example usage, assuming A and B are long int:
long int result = INT_MULTIPLY_WRAPV (a, b);
printf ("result is %ld (%s)\n", result,
INT_MULTIPLY_OVERFLOW (a, b) ? "after overflow" : "no overflow");
if (INT_MULTIPLY_OVERFLOW (a, b))
printf ("result would overflow\n");
else
printf ("result is %ld (no overflow)\n", a * b);
Example usage with WRAPV flavor:
@ -305,8 +315,12 @@
_GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
#define INT_SUBTRACT_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
#define INT_NEGATE_OVERFLOW(a) \
INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
#if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
#else
# define INT_NEGATE_OVERFLOW(a) \
INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
#endif
#define INT_MULTIPLY_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
#define INT_DIVIDE_OVERFLOW(a, b) \
@ -326,7 +340,7 @@
_GL_INT_MINIMUM (0 * (b) + (a)), \
_GL_INT_MAXIMUM (0 * (b) + (a)))
/* Compute A + B, A - B, A * B, respectively, storing the result into *R.
/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
Return 1 if the result overflows. See above for restrictions. */
#define INT_ADD_WRAPV(a, b, r) \
_GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
@ -351,10 +365,11 @@
# define _GL__GENERIC_BOGUS 0
#endif
/* Store A <op> B into *R, where OP specifies the operation.
BUILTIN is the builtin operation, and OVERFLOW the overflow predicate.
See above for restrictions. */
#if 5 <= __GNUC__ || __has_builtin (__builtin_add_oveflow)
/* Store the low-order bits of A <op> B into *R, where OP specifies
the operation. BUILTIN is the builtin operation, and OVERFLOW the
overflow predicate. Return 1 if the result overflows. See above
for restrictions. */
#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
@ -404,14 +419,15 @@
/* Store the low-order bits of A <op> B into *R, where the operation
is given by OP. Use the unsigned type UT for calculation to avoid
overflow problems. *R's type is T, with extremal values TMIN and
TMAX. T must be a signed integer type. */
TMAX. T must be a signed integer type. Return 1 if the result
overflows. */
#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
(sizeof ((a) op (b)) < sizeof (t) \
? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
: _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax))
#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \
((overflow (a, b) \
|| (_GL_INT_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
|| (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
|| (tmax) < ((a) op (b))) \
? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \
: (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0))

View file

@ -1,5 +1,5 @@
/* isatty() replacement.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Replacement for 'int' to 'long double' conversion routine.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2006, 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2003, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2000-2003, 2009-2016 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Work around a bug of lstat on some systems
Copyright (C) 1997-2006, 2008-2015 Free Software Foundation, Inc.
Copyright (C) 1997-2006, 2008-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* malloc() function that is glibc compatible.
Copyright (C) 1997-1998, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1997-1998, 2006-2007, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
Copyright (C) 1999-2002, 2005-2015 Free Software Foundation, Inc.
Copyright (C) 1999-2002, 2005-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
@ -20,6 +20,11 @@
/* Specification. */
#include <wchar.h>
#if C_LOCALE_MAYBE_EILSEQ
# include "hard-locale.h"
# include <locale.h>
#endif
#if GNULIB_defined_mbstate_t
/* Implement mbrtowc() on top of mbtowc(). */
@ -328,6 +333,9 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
size_t
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
size_t ret;
wchar_t wc;
# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG
if (s == NULL)
{
@ -342,6 +350,9 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
return (size_t) -2;
# endif
if (! pwc)
pwc = &wc;
# if MBRTOWC_RETVAL_BUG
{
static mbstate_t internal_state;
@ -357,8 +368,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
size_t count = 0;
for (; n > 0; s++, n--)
{
wchar_t wc;
size_t ret = mbrtowc (&wc, s, 1, ps);
ret = mbrtowc (&wc, s, 1, ps);
if (ret == (size_t)(-1))
return (size_t)(-1);
@ -366,8 +376,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
if (ret != (size_t)(-2))
{
/* The multibyte character has been completed. */
if (pwc != NULL)
*pwc = wc;
*pwc = wc;
return (wc == 0 ? 0 : count);
}
}
@ -376,32 +385,23 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
# endif
ret = mbrtowc (pwc, s, n, ps);
# if MBRTOWC_NUL_RETVAL_BUG
{
wchar_t wc;
size_t ret = mbrtowc (&wc, s, n, ps);
if (ret != (size_t)(-1) && ret != (size_t)(-2))
{
if (pwc != NULL)
*pwc = wc;
if (wc == 0)
ret = 0;
}
return ret;
}
# else
{
# if MBRTOWC_NULL_ARG1_BUG
wchar_t dummy;
if (pwc == NULL)
pwc = &dummy;
# endif
return mbrtowc (pwc, s, n, ps);
}
if (ret < (size_t) -2 && !*pwc)
return 0;
# endif
# if C_LOCALE_MAYBE_EILSEQ
if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE))
{
unsigned char uc = *s;
*pwc = uc;
return 1;
}
# endif
return ret;
}
#endif

View file

@ -1,5 +1,5 @@
/* Test for initial conversion state.
Copyright (C) 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2008-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2015
/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2016
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),

View file

@ -1,5 +1,5 @@
/* Copy memory area and return pointer after last written byte.
Copyright (C) 2003, 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2003, 2007, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2015 Free Software
/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2016 Free Software
Foundation, Inc.
This file is derived from the one in the GNU C Library.

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2015 Free Software
/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2016 Free Software
Foundation, Inc.
This file is derived from the one in the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Define PATH_MAX somehow. Requires sys/types.h.
Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2015 Free Software
Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Decomposed printf argument list.
Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2015 Free Software
Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Decomposed printf argument list.
Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2015 Free Software
Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Formatted output to strings.
Copyright (C) 1999-2000, 2002-2003, 2006-2015 Free Software Foundation, Inc.
Copyright (C) 1999-2000, 2002-2003, 2006-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Parse printf format string.
Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2015 Free Software
Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Program name management.
Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2003, 2005-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Program name management.
Copyright (C) 2001-2004, 2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2004, 2006, 2009-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* quote.h - prototypes for quote.c
Copyright (C) 1998-2001, 2003, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1998-2001, 2003, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998-2002, 2004-2015 Free Software Foundation, Inc.
Copyright (C) 1998-2002, 2004-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* quotearg.h - quote arguments for output
Copyright (C) 1998-2002, 2004, 2006, 2008-2015 Free Software Foundation,
Copyright (C) 1998-2002, 2004, 2006, 2008-2016 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Searching in a string.
Copyright (C) 2008-2015 Free Software Foundation, Inc.
Copyright (C) 2008-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
# Add this package to a list of references stored in a text file.
#
# Copyright (C) 2000, 2009-2015 Free Software Foundation, Inc.
# Copyright (C) 2000, 2009-2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
# Remove this package from a list of references stored in a text file.
#
# Copyright (C) 2000, 2009-2015 Free Software Foundation, Inc.
# Copyright (C) 2000, 2009-2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* Look up an environment variable more securely.
/* Look up an environment variable, returning NULL in insecure situations.
Copyright 2013-2015 Free Software Foundation, Inc.
Copyright 2013-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
@ -20,22 +20,35 @@
#include <stdlib.h>
#if !HAVE___SECURE_GETENV
# if HAVE_ISSETUGID
# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID)
# include <unistd.h>
# else
# undef issetugid
# define issetugid() 1
# endif
#endif
char *
secure_getenv (char const *name)
{
#if HAVE___SECURE_GETENV
#if HAVE___SECURE_GETENV /* glibc */
return __secure_getenv (name);
#else
#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */
if (issetugid ())
return 0;
return NULL;
return getenv (name);
#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */
if (geteuid () != getuid () || getegid () != getgid ())
return NULL;
return getenv (name);
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */
/* On native Windows, there is no such concept as setuid or setgid binaries.
- Programs launched as system services have high privileges, but they don't
inherit environment variables from a user.
- Programs launched by a user with "Run as Administrator" have high
privileges and use the environment variables, but the user has been asked
whether he agrees.
- Programs launched by a user without "Run as Administrator" cannot gain
high privileges, therefore there is no risk. */
return getenv (name);
#else
return NULL;
#endif
}

View file

@ -1,5 +1,5 @@
/* size_max.h -- declare SIZE_MAX through system headers
Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2005-2006, 2009-2016 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Pausing execution of the current thread.
Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2007, 2009-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Work around platform bugs in stat.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A substitute for ISO C11 <stdalign.h>.
Copyright 2011-2015 Free Software Foundation, Inc.
Copyright 2011-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -103,15 +103,15 @@
# elif ((defined __APPLE__ && defined __MACH__ \
? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
: __GNUC__) \
|| __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
|| __ICC || 0x590 <= __SUNPRO_C)
|| 061200 <= __HP_cc || 061200 <= __HP_aCC \
|| __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
# elif 1300 <= _MSC_VER
# define _Alignas(a) __declspec (align (a))
# endif
#endif
#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \
|| (defined __STDC_VERSION && 201112 <= __STDC_VERSION__))
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
# define alignas _Alignas
#endif
#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
/* Copyright (C) 2001-2003, 2006-2016 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -81,8 +81,10 @@
# define wchar_t int
#endif
/* Some platforms lack max_align_t. */
#if !@HAVE_MAX_ALIGN_T@
/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
a hack in case the configure-time test was done with g++ even though
we are currently compiling with gcc. */
#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T)
/* On the x86, the maximum storage alignment of double, long, etc. is 4,
but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
and the C11 standard allows this. Work around this problem by

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2001-2002, 2004-2015 Free Software Foundation, Inc.
/* Copyright (C) 2001-2002, 2004-2016 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
@ -118,15 +118,10 @@
picky compilers. */
#define _STDINT_MIN(signed, bits, zero) \
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
#define _STDINT_MAX(signed, bits, zero) \
((signed) \
? ~ _STDINT_MIN (signed, bits, zero) \
: /* The expression for the unsigned case. The subtraction of (signed) \
is a nop in the unsigned case and avoids "signed integer overflow" \
warnings in the signed case. */ \
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
(((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
#if !GNULIB_defined_stdint_types
@ -288,12 +283,17 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
/* 7.18.1.4. Integer types capable of holding object pointers */
/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
definitions of intptr_t and uintptr_t (which use int and unsigned)
to avoid clashes with declarations of system functions like sbrk. */
#ifndef _INTPTR_T_DECLARED
#undef intptr_t
#undef uintptr_t
typedef long int gl_intptr_t;
typedef unsigned long int gl_uintptr_t;
#define intptr_t gl_intptr_t
#define uintptr_t gl_uintptr_t
#endif
/* 7.18.1.5. Greatest-width integer types */

View file

@ -1,6 +1,6 @@
/* A GNU-like <stdio.h>.
Copyright (C) 2004, 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2004, 2007-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, Inc.
Copyright (C) 1995, 2001-2004, 2006-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* stpcpy.c -- copy a string and return pointer to end of new string
Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2015 Free Software
Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2016 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
Copyright (C) 1998-1999, 2005-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2007, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Searching in a string.
Copyright (C) 2003, 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* Optimized string comparison.
Copyright (C) 2001-2002, 2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2001-2002, 2007, 2009-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published

View file

@ -1,6 +1,6 @@
/* strerror-override.c --- POSIX compatible system error routine
Copyright (C) 2010-2015 Free Software Foundation, Inc.
Copyright (C) 2010-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* strerror-override.h --- POSIX compatible system error routine
Copyright (C) 2010-2015 Free Software Foundation, Inc.
Copyright (C) 2010-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* strerror.c --- POSIX compatible system error routine
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2016 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A GNU-like <string.h>.
Copyright (C) 1995-1996, 2001-2015 Free Software Foundation, Inc.
Copyright (C) 1995-1996, 2001-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A substitute <strings.h>.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Copyright (C) 2007-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* stripslash.c -- remove redundant trailing slashes from a file name
Copyright (C) 1990, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Copyright (C) 1990, 2001, 2003-2006, 2009-2016 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* strncasecmp.c -- case insensitive string comparator
Copyright (C) 1998-1999, 2005-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2007, 2009-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* A replacement function, for systems that lack strndup.
Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2015 Free Software
Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2016 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it

View file

@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
Copyright (C) 2005-2007, 2009-2016 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Compare strings while treating digits numerically. -*- coding: utf-8 -*-
Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2015 Free Software
Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2016 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.

View file

@ -1,5 +1,5 @@
/* Provide a more complete sys/stat header file.
Copyright (C) 2005-2015 Free Software Foundation, Inc.
Copyright (C) 2005-2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show more