From f9fa25dca3c78a2298e466e1b33caca0ee7e458b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Nov 2002 21:45:29 +0000 Subject: [PATCH] Include gettext.h instead of with #ifdefs. --- lib/ChangeLog | 24 ++++++++++++++++++++++++ lib/argmatch.c | 14 +++----------- lib/closeout.c | 12 ++++-------- lib/error.c | 11 ++++++----- lib/getopt.c | 21 +++++++++------------ lib/human.c | 10 +++------- lib/long-options.c | 9 +-------- lib/makepath.c | 12 ++---------- lib/obstack.c | 17 +++++++---------- lib/quotearg.c | 10 +++------- lib/regex.c | 22 ++++++++-------------- lib/rpmatch.c | 6 +++--- lib/same.c | 9 +-------- lib/unicodeio.c | 12 ++++-------- lib/userspec.c | 10 +++------- lib/version-etc.c | 8 ++------ lib/xmalloc.c | 13 ++++--------- lib/xmemcoll.c | 8 ++------ 18 files changed, 89 insertions(+), 139 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 63c9751e8..a3471c3fd 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,27 @@ +2002-11-05 Bruno Haible + + * error.c [!_LIBC]: Include gettext.h instead of . + * getopt.c [!_LIBC]: Include gettext.h instead of . + * obstack.c [!_LIBC]: Include gettext.h instead of . + * regex.c [!_LIBC]: Include gettext.h instead of . + + * argmatch.c: Include gettext.h instead of and . + * makepath.c: Include gettext.h instead of and . + + * closeout.c: Include gettext.h instead of . + * human.c: Include gettext.h instead of . + * quotearg.c: Include gettext.h instead of . + * rpmatch.c: Include gettext.h instead of . + * unicodeio.c: Include gettext.h instead of . + * userspec.c: Include gettext.h instead of . + * version-etc.c: Include gettext.h instead of . + * xmalloc.c: Include gettext.h instead of . + (textdomain): Remove definition. + * xmemcoll.c: Include gettext.h instead of . + + * long-options.c: Remove include of and definition of _. + * same.c: Remove include of and definition of _. + 2002-11-04 Bruno Haible * stpcpy.h: New file, from GNU gettext-0.11.5. diff --git a/lib/argmatch.c b/lib/argmatch.c index 005be881f..2293f67cc 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -1,5 +1,5 @@ /* argmatch.c -- find a match for a string in an array - Copyright (C) 1990, 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1990, 1998, 1999, 2001, 2002 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 @@ -25,16 +25,8 @@ # include #endif -#if HAVE_LOCALE_H -# include -#endif - -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) #include "error.h" #include "quotearg.h" diff --git a/lib/closeout.c b/lib/closeout.c index 0c78b6e4c..90606f246 100644 --- a/lib/closeout.c +++ b/lib/closeout.c @@ -1,5 +1,5 @@ /* closeout.c - close standard output - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002 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 @@ -19,13 +19,6 @@ # include #endif -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif - #if HAVE_STDLIB_H # include #endif @@ -40,6 +33,9 @@ extern int errno; #endif +#include "gettext.h" +#define _(msgid) gettext (msgid) + #include "closeout.h" #include "error.h" #include "quotearg.h" diff --git a/lib/error.c b/lib/error.c index c02abcee8..db97393d0 100644 --- a/lib/error.c +++ b/lib/error.c @@ -25,9 +25,14 @@ #endif #include -#if HAVE_LIBINTL_H + +#ifdef _LIBC # include +#else +# include "gettext.h" #endif +#define _(msgid) gettext (msgid) + #ifdef _LIBC # include # define mbsrtowcs __mbsrtowcs @@ -56,10 +61,6 @@ void exit (); #include "error.h" #include "unlocked-io.h" -#ifndef _ -# define _(String) String -#endif - /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ diff --git a/lib/getopt.c b/lib/getopt.c index 289d137e2..9917d9a64 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -76,19 +76,16 @@ # endif #endif -#ifndef _ +#ifdef _LIBC +# include +#else /* This is for other GNU distributions with internationalized messages. */ -# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC -# include -# ifndef _ -# define _(msgid) gettext (msgid) -# endif -# else -# define _(msgid) (msgid) -# endif -# if defined _LIBC && defined USE_IN_LIBIO -# include -# endif +# include "gettext.h" +#endif +#define _(msgid) gettext (msgid) + +#if defined _LIBC && defined USE_IN_LIBIO +# include #endif #ifndef attribute_hidden diff --git a/lib/human.c b/lib/human.c index a9ccf38c4..2367137e0 100644 --- a/lib/human.c +++ b/lib/human.c @@ -1,6 +1,6 @@ /* human.c -- print human readable file size - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -52,12 +52,8 @@ char *getenv (); #endif -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) #include #include diff --git a/lib/long-options.c b/lib/long-options.c index e36685fb0..43df8594e 100644 --- a/lib/long-options.c +++ b/lib/long-options.c @@ -1,5 +1,5 @@ /* Utility to accept --help and --version options as unobtrusively as possible. - Copyright (C) 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1993-1994, 1998-1999, 2000, 2002 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 @@ -30,13 +30,6 @@ #include "long-options.h" #include "version-etc.h" -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif - static struct option const long_options[] = { {"help", no_argument, 0, 'h'}, diff --git a/lib/makepath.c b/lib/makepath.c index bebd245cd..fbe3f6a65 100644 --- a/lib/makepath.c +++ b/lib/makepath.c @@ -103,16 +103,8 @@ extern int errno; /* Include this before libintl.h so we get our definition of PARAMS. */ #include "makepath.h" -#if HAVE_LOCALE_H -# include -#endif - -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) #include "save-cwd.h" #include "dirname.h" diff --git a/lib/obstack.c b/lib/obstack.c index 0244da383..0ef6c912f 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -1,5 +1,5 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1988-1994, 1996-1999, 2000-2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -458,16 +458,13 @@ _obstack_memory_used (h) } /* Define the error handler. */ -# ifndef _ -# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC -# include -# ifndef _ -# define _(Str) gettext (Str) -# endif -# else -# define _(Str) (Str) -# endif +# ifdef _LIBC +# include +# else +# include "gettext.h" # endif +# define _(msgid) gettext (msgid) + # if defined _LIBC && defined USE_IN_LIBIO # include # define fputs(s, f) _IO_fputs (s, f) diff --git a/lib/quotearg.c b/lib/quotearg.c index 9d4395659..2dc9b1c47 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -30,13 +30,9 @@ #include -#if ENABLE_NLS -# include -# define _(text) gettext (text) -#else -# define _(text) text -#endif -#define N_(text) text +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid #if HAVE_LIMITS_H # include diff --git a/lib/regex.c b/lib/regex.c index 7d7a9793e..4cb470305 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -2,7 +2,7 @@ version 0.12. (Implements POSIX draft P1003.2/D11.2, except for some of the internationalization features.) - Copyright (C) 1993-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1993-1999, 2000-2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -95,21 +95,15 @@ # include # endif -/* This is for other GNU distributions with internationalized messages. */ -# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC +# ifdef _LIBC # include -# ifdef _LIBC -# undef gettext -# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES) -# endif +# undef gettext +# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES) + /* This define is so xgettext can find the internationalizable strings. */ +# define gettext_noop(msgid) msgid # else -# define gettext(msgid) (msgid) -# endif - -# ifndef gettext_noop -/* This define is so xgettext can find the internationalizable - strings. */ -# define gettext_noop(String) String +/* This is for other GNU distributions with internationalized messages. */ +# include "gettext.h" # endif /* Support for bounded pointers. */ diff --git a/lib/rpmatch.c b/lib/rpmatch.c index 0988f07d0..02c2abdb8 100644 --- a/lib/rpmatch.c +++ b/lib/rpmatch.c @@ -1,6 +1,6 @@ /* Determine whether string value is affirmation or negative response according to current locale's data. - Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1996, 1998, 2000, 2002 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 @@ -35,8 +35,8 @@ # include # endif # include -# include -# define _(Text) gettext (Text) +# include "gettext.h" +# define _(msgid) gettext (msgid) static int try (const char *response, const char *pattern, const int match, diff --git a/lib/same.c b/lib/same.c index 0e2807ac2..b32e3dab9 100644 --- a/lib/same.c +++ b/lib/same.c @@ -1,5 +1,5 @@ /* Determine whether two file names refer to the same file. - Copyright (C) 1997-2000 Free Software Foundation, Inc. + Copyright (C) 1997-2000, 2002 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 @@ -47,13 +47,6 @@ extern int errno; #include "error.h" #include "xalloc.h" -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif - #ifndef HAVE_DECL_FREE "this configure-time declaration test was not run" #endif diff --git a/lib/unicodeio.c b/lib/unicodeio.c index 049b9afd0..2e7ffc9d0 100644 --- a/lib/unicodeio.c +++ b/lib/unicodeio.c @@ -20,7 +20,7 @@ /* Written by Bruno Haible . */ /* Note: This file requires the locale_charset() function. See in - libiconv-1.7/libcharset/INTEGRATE for how to obtain it. */ + libiconv-1.8/libcharset/INTEGRATE for how to obtain it. */ #ifdef HAVE_CONFIG_H # include @@ -48,13 +48,9 @@ extern int errno; #include -#if ENABLE_NLS -# include -#else -# define gettext(Text) Text -#endif -#define _(Text) gettext (Text) -#define N_(Text) Text +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid /* Specification. */ #include "unicodeio.h" diff --git a/lib/userspec.c b/lib/userspec.c index 1d3df6e44..9def456ad 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -68,13 +68,9 @@ char *alloca (); #include "xalloc.h" #include "xstrtol.h" -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif -#define N_(Text) Text +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid #ifndef _POSIX_VERSION struct passwd *getpwnam (); diff --git a/lib/version-etc.c b/lib/version-etc.c index 4d4facf0c..57bf1248c 100644 --- a/lib/version-etc.c +++ b/lib/version-etc.c @@ -25,12 +25,8 @@ #include "unlocked-io.h" #include "version-etc.h" -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) /* Default copyright goes to the FSF. */ diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 2f103d604..df95ecdf6 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -1,5 +1,5 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1990-1999, 2000, 2002 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 @@ -30,14 +30,9 @@ void *realloc (); void free (); #endif -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define textdomain(Domain) -# define _(Text) Text -#endif -#define N_(Text) Text +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid #include "error.h" #include "xalloc.h" diff --git a/lib/xmemcoll.c b/lib/xmemcoll.c index 0e35cb677..7fe06b8cb 100644 --- a/lib/xmemcoll.c +++ b/lib/xmemcoll.c @@ -28,12 +28,8 @@ extern int errno; #include -#if ENABLE_NLS -# include -# define _(Text) gettext (Text) -#else -# define _(Text) Text -#endif +#include "gettext.h" +#define _(msgid) gettext (msgid) #include "error.h" #include "memcoll.h" -- 2.11.0