changeset 3966:22d3032f0239

Include gettext.h instead of <libintl.h> with #ifdefs.
author Bruno Haible <bruno@clisp.org>
date Tue, 05 Nov 2002 21:45:29 +0000
parents b62502a177f7
children e8562282a2d0
files lib/ChangeLog lib/argmatch.c lib/closeout.c lib/error.c lib/getopt.c lib/human.c lib/long-options.c lib/makepath.c lib/obstack.c lib/quotearg.c lib/regex.c lib/rpmatch.c lib/same.c lib/unicodeio.c lib/userspec.c lib/version-etc.c lib/xmalloc.c lib/xmemcoll.c
diffstat 18 files changed, 89 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,27 @@
+2002-11-05  Bruno Haible  <bruno@clisp.org>
+
+	* error.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
+	* getopt.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
+	* obstack.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
+	* regex.c [!_LIBC]: Include gettext.h instead of <libintl.h>.
+
+	* argmatch.c: Include gettext.h instead of <locale.h> and <libintl.h>.
+	* makepath.c: Include gettext.h instead of <locale.h> and <libintl.h>.
+
+	* closeout.c: Include gettext.h instead of <libintl.h>.
+	* human.c: Include gettext.h instead of <libintl.h>.
+	* quotearg.c: Include gettext.h instead of <libintl.h>.
+	* rpmatch.c: Include gettext.h instead of <libintl.h>.
+	* unicodeio.c: Include gettext.h instead of <libintl.h>.
+	* userspec.c: Include gettext.h instead of <libintl.h>.
+	* version-etc.c: Include gettext.h instead of <libintl.h>.
+	* xmalloc.c: Include gettext.h instead of <libintl.h>.
+	(textdomain): Remove definition.
+	* xmemcoll.c: Include gettext.h instead of <libintl.h>.
+
+	* long-options.c: Remove include of <libintl.h> and definition of _.
+	* same.c: Remove include of <libintl.h> and definition of _.
+
 2002-11-04  Bruno Haible  <bruno@clisp.org>
 
 	* stpcpy.h: New file, from GNU gettext-0.11.5.
--- 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 <string.h>
 #endif
 
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
-
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
 
 #include "error.h"
 #include "quotearg.h"
--- 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 <config.h>
 #endif
 
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
-
 #if HAVE_STDLIB_H
 # include <stdlib.h>
 #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"
--- a/lib/error.c
+++ b/lib/error.c
@@ -25,9 +25,14 @@
 #endif
 
 #include <stdio.h>
-#if HAVE_LIBINTL_H
+
+#ifdef _LIBC
 # include <libintl.h>
+#else
+# include "gettext.h"
 #endif
+#define _(msgid) gettext (msgid)
+
 #ifdef _LIBC
 # include <wchar.h>
 # define mbsrtowcs __mbsrtowcs
@@ -56,10 +61,6 @@
 #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.  */
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -76,19 +76,16 @@
 # endif
 #endif
 
-#ifndef _
+#ifdef _LIBC
+# include <libintl.h>
+#else
 /* This is for other GNU distributions with internationalized messages.  */
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-#  include <libintl.h>
-#  ifndef _
-#   define _(msgid)	gettext (msgid)
-#  endif
-# else
-#  define _(msgid)	(msgid)
-# endif
-# if defined _LIBC && defined USE_IN_LIBIO
-#  include <wchar.h>
-# endif
+# include "gettext.h"
+#endif
+#define _(msgid) gettext (msgid)
+
+#if defined _LIBC && defined USE_IN_LIBIO
+# include <wchar.h>
 #endif
 
 #ifndef attribute_hidden
--- 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 <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
 
 #include <argmatch.h>
 #include <error.h>
--- 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 <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
-
 static struct option const long_options[] =
 {
   {"help", no_argument, 0, 'h'},
--- a/lib/makepath.c
+++ b/lib/makepath.c
@@ -103,16 +103,8 @@
 /* Include this before libintl.h so we get our definition of PARAMS. */
 #include "makepath.h"
 
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
-
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
 
 #include "save-cwd.h"
 #include "dirname.h"
--- 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 @@
 }
 
 /* Define the error handler.  */
-# ifndef _
-#  if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-#   include <libintl.h>
-#   ifndef _
-#    define _(Str) gettext (Str)
-#   endif
-#  else
-#   define _(Str) (Str)
-#  endif
+# ifdef _LIBC
+#  include <libintl.h>
+# else
+#  include "gettext.h"
 # endif
+# define _(msgid) gettext (msgid)
+
 # if defined _LIBC && defined USE_IN_LIBIO
 #  include <libio/iolibio.h>
 #  define fputs(s, f) _IO_fputs (s, f)
--- a/lib/quotearg.c
+++ b/lib/quotearg.c
@@ -30,13 +30,9 @@
 
 #include <ctype.h>
 
-#if ENABLE_NLS
-# include <libintl.h>
-# 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 <limits.h>
--- 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 <locale/coll-lookup.h>
 # endif
 
-/* This is for other GNU distributions with internationalized messages.  */
-# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+# ifdef _LIBC
 #  include <libintl.h>
-#  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.  */
--- 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 <limits.h>
 # endif
 # include <regex.h>
-# include <libintl.h>
-# define _(Text) gettext (Text)
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
 
 static int
 try (const char *response, const char *pattern, const int match,
--- 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 @@
 #include "error.h"
 #include "xalloc.h"
 
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
-
 #ifndef HAVE_DECL_FREE
 "this configure-time declaration test was not run"
 #endif
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -20,7 +20,7 @@
 /* Written by Bruno Haible <haible@clisp.cons.org>.  */
 
 /* 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 <config.h>
@@ -48,13 +48,9 @@
 
 #include <error.h>
 
-#if ENABLE_NLS
-# include <libintl.h>
-#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"
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -68,13 +68,9 @@
 #include "xalloc.h"
 #include "xstrtol.h"
 
-#if ENABLE_NLS
-# include <libintl.h>
-# 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 ();
--- 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 <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
 
 /* Default copyright goes to the FSF. */
 
--- 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 free ();
 #endif
 
-#if ENABLE_NLS
-# include <libintl.h>
-# 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"
--- a/lib/xmemcoll.c
+++ b/lib/xmemcoll.c
@@ -28,12 +28,8 @@
 
 #include <stdlib.h>
 
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define _(Text) Text
-#endif
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
 
 #include "error.h"
 #include "memcoll.h"