Commit f9a76264 authored by Niels Möller's avatar Niels Möller

Updated argp from glibc-2.2.

Rev: src/argp/Makefile.am:1.3
Rev: src/argp/acconfig.h:1.1
Rev: src/argp/argp-ba.c:1.2
Rev: src/argp/argp-comp.h:1.4(DEAD)
Rev: src/argp/argp-fmtstream.c:1.4
Rev: src/argp/argp-fmtstream.h:1.6
Rev: src/argp/argp-help.c:1.10
Rev: src/argp/argp-parse.c:1.6
Rev: src/argp/argp-pin.c:1.2(DEAD)
Rev: src/argp/argp-pv.c:1.2
Rev: src/argp/argp-pvh.c:1.2
Rev: src/argp/argp-test.c:1.2
Rev: src/argp/argp.h:1.8
Rev: src/argp/configure.in:1.1
parent dfb9b232
# From glibc-2.1
# From glibc
# Copyright (C) 1997 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
......@@ -21,15 +21,16 @@
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libargp.a
noinst_HEADERS = argp.h argp-fmtstream.h argp-namefrob.h argp-comp.h
noinst_PROGRAMS = argp-test
noinst_HEADERS = argp.h argp-fmtstream.h argp-namefrob.h # argp-comp.h
all: libargp.a
EXTRA_DIST = argp-fmtstream.h argp-namefrob.h
# EXTRA_DIST = argp-fmtstream.h argp-namefrob.h
# Leaves out argp-fs-xinl.c and argp-xinl.c
libargp_a_SOURCES = argp-ba.c argp-fmtstream.c \
argp-help.c argp-parse.c argp-pin.c argp-pv.c \
libargp_a_SOURCES = argp-ba.c argp-eexst.c argp-fmtstream.c \
argp-help.c argp-parse.c argp-pv.c \
argp-pvh.c argp-eexst.c
argp_test_LIBS = libargp.a
/* Global variables needed by argp */
#undef HAVE_PROGRAM_INVOCATION_NAME
#undef HAVE_PROGRAM_INVOCATION_SHORT_NAME
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
......@@ -23,4 +23,4 @@
the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
messages), embedded in a sentence that says something like `Report bugs to
ADDR.'. */
const char *argp_program_bug_address = 0;
const char *argp_program_bug_address;
/* argp-comp.h
*
* Portability stuff for compiling argp outside of glibc.
*/
/* lsh, an implementation of the ssh protocol
*
* Copyright (C) 1998 Niels Möller
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LSH_ARGP_COMP_H_INCLUDED
#define LSH_ARGP_COMP_H_INCLUDED
#include "lsh_types.h"
/* Missing declarations. */
extern char *program_invocation_name;
extern char *program_invocation_short_name;
void
_argp_unlock_xxx (void);
#ifndef __THROW
#define __THROW
#endif
#if !HAVE_MEMPCPY
#include "mempcpy.h"
#endif
#if !HAVE_STRNDUP
#include "strndup.h"
#endif
#include <string.h>
#ifndef __mempcpy
#define __mempcpy mempcpy
#endif
/* For some reason, I can't get this to interact correctly with the header files on my glibc system.
* So instead, I edited the code in argp-help.c that tried to use __strndup. */
#if 1
#ifndef __strndup
#define __strndup strndup
#endif
#endif
/* Ugly hack. lsh doesn't use threads, nor stdio */
#if !HAVE_FWRITE_UNLOCKED
#define fwrite_unlocked fwrite
#endif
#if !HAVE_FPUTS_UNLOCKED
#define fputs_unlocked fputs
#endif
#endif /* LSH_ARGP_COMP_H_INCLUDED */
/* Word-wrapping and line-truncating streams
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
......@@ -94,7 +94,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
{
__argp_fmtstream_update (fs);
if (fs->p > fs->buf)
FWRITE_UNLOCKED (fs->buf, 1, fs->p - fs->buf, fs->stream);
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
free (fs->buf);
free (fs);
}
......@@ -134,7 +134,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
/* No buffer space for spaces. Must flush. */
size_t i;
for (i = 0; i < pad; i++)
PUTC_UNLOCKED (' ', fs->stream);
putc_unlocked (' ', fs->stream);
}
fs->point_col = pad;
}
......@@ -268,8 +268,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
/* Output the first line so we can use the space. */
{
if (nl > fs->buf)
FWRITE_UNLOCKED (fs->buf, 1, nl - fs->buf, fs->stream);
PUTC_UNLOCKED ('\n', fs->stream);
fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
putc_unlocked ('\n', fs->stream);
len += buf - fs->buf;
nl = buf = fs->buf;
}
......@@ -286,7 +286,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
*nl++ = ' ';
else
for (i = 0; i < fs->wmargin; ++i)
PUTC_UNLOCKED (' ', fs->stream);
putc_unlocked (' ', fs->stream);
/* Copy the tail of the original buffer into the current buffer
position. */
......@@ -323,7 +323,7 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
/* Flush FS's buffer. */
__argp_fmtstream_update (fs);
wrote = FWRITE_UNLOCKED (fs->buf, 1, fs->p - fs->buf, fs->stream);
wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
if (wrote == fs->p - fs->buf)
{
fs->p = fs->buf;
......@@ -361,7 +361,8 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
ssize_t
__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
{
int out;
size_t out;
size_t avail;
size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
do
......@@ -370,13 +371,15 @@ __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
if (! __argp_fmtstream_ensure (fs, size_guess))
return -1;
size_guess += size_guess;
va_start (args, fmt);
out = __vsnprintf (fs->p, fs->end - fs->p, fmt, args);
avail = fs->end - fs->p;
out = __vsnprintf (fs->p, avail, fmt, args);
va_end (args);
if (out >= avail)
size_guess = out + 1;
}
while (out == -1);
while (out >= avail);
fs->p += out;
......@@ -387,85 +390,3 @@ weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
#endif
#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
size_t
__argp_fmtstream_write (argp_fmtstream_t __fs,
__const char *__str, size_t __len)
{
if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
{
memcpy (__fs->p, __str, __len);
__fs->p += __len;
return __len;
}
else
return 0;
}
int
__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
{
size_t __len = strlen (__str);
if (__len)
{
size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
return __wrote == __len ? 0 : -1;
}
else
return 0;
}
int
__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
{
if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
return *__fs->p++ = __ch;
else
return EOF;
}
/* Set __FS's left margin to __LMARGIN and return the old value. */
size_t
__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->lmargin;
__fs->lmargin = __lmargin;
return __old;
}
/* Set __FS's right margin to __RMARGIN and return the old value. */
size_t
__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->rmargin;
__fs->rmargin = __rmargin;
return __old;
}
/* Set FS's wrap margin to __WMARGIN and return the old value. */
size_t
__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
{
size_t __old;
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
__old = __fs->wmargin;
__fs->wmargin = __wmargin;
return __old;
}
/* Return the column number of the current output point in __FS. */
size_t
__argp_fmtstream_point (argp_fmtstream_t __fs)
{
if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
__argp_fmtstream_update (__fs);
return __fs->point_col >= 0 ? __fs->point_col : 0;
}
......@@ -34,24 +34,6 @@
#include <string.h>
#include <unistd.h>
#include "argp.h"
#if (_LIBC || \
(defined (HAVE_FLOCKFILE) && defined(HAVE_PUTC_UNLOCKED) \
&& defined (HAVE_FPUTS_UNLOCKED) && defined (HAVE_FWRITE_UNLOCKED) ))
# define FLOCKFILE(f) flockfile(f)
# define FUNLOCKFILE(f) funlockfile(f)
# define PUTC_UNLOCKED(c, f) putc_unlocked(c, f)
# define FPUTS_UNLOCKED(s, f) fputs_unlocked(s, f)
# define FWRITE_UNLOCKED(b, s, n, f) fwrite_unlocked(b, s, n, f)
#else /* Don't use stdio locking */
# define FLOCKFILE(f)
# define FUNLOCKFILE(f)
# define PUTC_UNLOCKED(c, f) putc((c), (f))
# define FPUTS_UNLOCKED(s, f) fputs((s), (f))
# define FWRITE_UNLOCKED(b, s, n, f) fwrite((b), (s), (n), (f))
#endif /* No thread safe i/o */
#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
|| (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
/* line_wrap_stream is available, so use that. */
......@@ -144,10 +126,10 @@ extern void argp_fmtstream_free (argp_fmtstream_t __fs);
extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
__const char *__fmt, ...)
PRINTF_STYLE(2, 3);
__attribute__ ((__format__ (printf, 2, 3)));
extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
__const char *__fmt, ...)
PRINTF_STYLE(2, 3);
__attribute__ ((__format__ (printf, 2, 3)));
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
......
/* Hierarchial argument parsing help output
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
......@@ -45,12 +45,6 @@ char *alloca ();
# endif
#endif
#if __GNUC__ && HAVE_GCC_ATTRIBUTE
# define UNUSED __attribute__ ((__unused__))
#else
# define UNUSED
#endif
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
......@@ -59,24 +53,50 @@ char *alloca ();
#include <malloc.h>
#include <ctype.h>
#ifndef _
/* This is for other GNU distributions with internationalized messages. */
# ifdef HAVE_LIBINTL_H
# if defined HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
# ifdef _LIBC
# undef dgettext
# define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES)
# endif
# else
# define dgettext(domain, msgid) (((void) (domain), (msgid)))
# define dgettext(domain, msgid) (msgid)
# endif
#endif
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
#include "argp.h"
#include "argp-fmtstream.h"
#include "argp-namefrob.h"
#ifndef UNUSED
# if __GNUC__ >= 2
# define UNUSED __attribute__ ((__unused__))
# else
# define UNUSED
# endif
#endif
#ifndef _LIBC
# ifndef __strchrnul
# define __strchrnul strchrnul
# endif
/* FIXME: __strndup is a macro expanding to a call of the function
* __strndup which is not declared properly. */
# ifndef __strndup
# define __strndup strndup
# endif
# ifndef __flockfile
# define __flockfile flockfile
# endif
# ifndef __funlockfile
# define __funlockfile funlockfile
# endif
#endif
#if !_LIBC
# if !HAVE_STRNDUP
......@@ -105,9 +125,25 @@ static void *mempcpy (void *to, const void *from, size_t size)
memcpy(to, from, size);
return (char *) to + size;
}
# define __mempcpy mempcpy
# endif /* !HAVE_MEMPCPY */
#endif /* !_LIBC - 0 */
# if !HAVE_STRCHRNUL
/* FIXME: What is this function supposed to do? My guess is that it is
* like strchr, but returns a pointer to the NUL character, not a NULL
* pointer, if the character isn't found. */
static char *strchrnul(const char *s, int c)
{
const char *p = s;
while (*p && (*p != c))
p++;
return (char *) p;
}
# endif /* !HAVE_STRCHRNUL */
#endif /* !_LIBC */
/* User-selectable (using an environment variable) formatting parameters.
......@@ -189,7 +225,7 @@ static const struct uparam_name uparam_names[] =
static void
fill_in_uparams (const struct argp_state *state)
{
const unsigned char *var = getenv ("ARGP_HELP_FMT");
const char *var = getenv ("ARGP_HELP_FMT");
#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
......@@ -204,7 +240,7 @@ fill_in_uparams (const struct argp_state *state)
size_t var_len;
const struct uparam_name *un;
int unspec = 0, val = 0;
const unsigned char *arg = var;
const char *arg = var;
while (isalnum (*arg) || *arg == '-' || *arg == '_')
arg++;
......@@ -400,7 +436,7 @@ struct hol_cluster
const char *header;
/* Used to order clusters within the same group with the same parent,
according to the order in which they occured in the parent argp's child
according to the order in which they occurred in the parent argp's child
list. */
int index;
......@@ -728,12 +764,12 @@ canon_doc_option (const char **name)
{
int non_opt;
/* Skip initial whitespace. */
while (isspace ( (unsigned char) **name))
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 ( (unsigned char) **name))
while (**name && !isalnum (**name))
(*name)++;
return non_opt;
}
......@@ -795,8 +831,8 @@ 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;
char first1 = short1 ? short1 : long1 ? *long1 : 0;
char first2 = short2 ? short2 : long2 ? *long2 : 0;
#ifdef _tolower
int lower_cmp = _tolower (first1) - _tolower (first2);
#else
......@@ -946,7 +982,7 @@ space (argp_fmtstream_t stream, size_t ensure)
optional argument. */
static void
arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
const char *domain, argp_fmtstream_t stream)
const char *domain UNUSED, argp_fmtstream_t stream)
{
if (real->arg)
{
......@@ -1093,18 +1129,8 @@ 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. */
#ifdef __GNUC__
struct pentry_state pest = { entry, stream, hhstate, 1, state };
#else /* !__GNUC__ */
/* Decent initializers is a GNU extension */
struct pentry_state pest;
pest.entry = entry;
pest.stream = stream;
pest.hhstate = hhstate;
pest.first = 1;
pest.state = state;
#endif /* !__GNUC__ */
if (! odoc (real))
for (opt = real, num = entry->num; num > 0; opt++, num--)
if (opt->name && ovisible (opt))
......@@ -1268,7 +1294,7 @@ add_argless_short_opt (const struct argp_option *opt,
static int
usage_argful_short_opt (const struct argp_option *opt,
const struct argp_option *real,
const char *domain, void *cookie)
const char *domain UNUSED, void *cookie)
{
argp_fmtstream_t stream = cookie;
const char *arg = opt->arg;
......@@ -1424,19 +1450,17 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
if (fdoc)
{
const char *cp = fdoc;
nl = strchr (cp, '\n');
if (nl)
nl = __strchrnul (cp, '\n');
if (*nl != '\0')
/* This is a `multi-level' args doc; advance to the correct position
as determined by our state in LEVELS, and update LEVELS. */
{
int i;
multiple = 1;
for (i = 0; i < *our_level; i++)
cp = nl + 1, nl = strchr (cp, '\n');
cp = nl + 1, nl = __strchrnul (cp, '\n');
(*levels)++;
}
if (! nl)
nl = cp + strlen (cp);
/* Manually do line wrapping so that it (probably) won't get wrapped at
any embedded spaces. */
......@@ -1474,7 +1498,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
following the `\v' character (nothing for strings without). Each separate
bit of documentation is separated a blank line, and if PRE_BLANK is true,
then the first is as well. If FIRST_ONLY is true, only the first
occurance is output. Returns true if anything was output. */
occurrence is output. Returns true if anything was output. */
static int
argp_doc (const struct argp *argp, const struct argp_state *state,
int post, int pre_blank, int first_only,
......@@ -1502,7 +1526,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
{
if (inp_text_limit)
/* Copy INP_TEXT so that it's nul-terminated. */
inp_text = strndup (inp_text, inp_text_limit);
inp_text = __strndup (inp_text, inp_text_limit);
input = __argp_input (argp, state);
text =
(*argp->help_filter) (post
......@@ -1576,7 +1600,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
if (! stream)
return;
FLOCKFILE (stream);
__flockfile (stream);
if (! uparams.valid)
fill_in_uparams (state);
......@@ -1584,7 +1608,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
if (! fs)
{
FUNLOCKFILE (stream);
__funlockfile (stream);
return;
}
......@@ -1692,7 +1716,7 @@ Try `%s --help' or `%s --usage' for more information.\n"),
anything = 1;
}
FUNLOCKFILE (stream);
__funlockfile (stream);
if (hol)
hol_free (hol);
......@@ -1751,22 +1775,22 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
{
va_list ap;
FLOCKFILE (stream);
__flockfile (stream);
FPUTS_UNLOCKED (state ? state->name : program_invocation_short_name,
fputs_unlocked (state ? state->name : program_invocation_short_name,
stream);
PUTC_UNLOCKED (':', stream);
PUTC_UNLOCKED (' ', stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
va_start (ap, fmt);
vfprintf (stream, fmt, ap);
va_end (ap);
PUTC_UNLOCKED ('\n', stream);
putc_unlocked ('\n', stream);
__argp_state_help (state, stream, ARGP_HELP_STD_ERR);
FUNLOCKFILE (stream);
__funlockfile (stream);
}
}
}
......@@ -1792,17 +1816,17 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
if (stream)
{
FLOCKFILE (stream);
__flockfile (stream);
FPUTS_UNLOCKED (state ? state->name : program_invocation_short_name,
fputs_unlocked (state ? state->name : program_invocation_short_name,
stream);
if (fmt)
{
va_list ap;
PUTC_UNLOCKED (':', stream);
PUTC_UNLOCKED (' ', stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
va_start (ap, fmt);
vfprintf (stream, fmt, ap);
......@@ -1811,14 +1835,14 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
if (errnum)
{
PUTC_UNLOCKED (':', stream);
PUTC_UNLOCKED (' ', stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
fputs (strerror (errnum), stream);
}
PUTC_UNLOCKED ('\n', stream);
putc_unlocked ('\n', stream);
FUNLOCKFILE (stream);
__funlockfile (stream);
if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
exit (status);
......
/* Hierarchial argument parsing, layered over getopt
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
......@@ -22,47 +22,36 @@
#include <config.h>
#endif
#ifndef alloca
# ifdef __GNUC__
# define alloca __builtin_alloca
# define HAVE_ALLOCA 1
# else
# if defined HAVE_ALLOCA_H || defined _LIBC
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca
char *alloca ();
# endif
# endif
# endif
# endif
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <getopt.h>
#ifndef UNUSED
# if __GNUC__ >= 2
# define UNUSED __attribute__ ((__unused__))
# else
# define UNUSED
# endif
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
#ifdef HAVE_LIBINTL_H
# include <libintl.h>
#else
# define dgettext(domain, msgid) (((void) (domain), (msgid)))
# define gettext(msgid) (((void) (domain), (msgid)))
#endif
#define N_(msgid) (msgid)
# if defined HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
# ifdef _LIBC
# undef dgettext
# define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES)