~ubuntu-branches/ubuntu/trusty/hello/trusty

« back to all changes in this revision

Viewing changes to intl/intl-compat.c

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2006-12-09 17:00:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209170014-514r5ix8d2stnox3
Tags: 2.2-1
* New upstream release.
* Repackaged source without GFDL manual.
* Option -m does no longer exist (Closes: #109895).
* Removed prerm and postinst, as info files are missing now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
2
 
   Library.
3
 
   Copyright (C) 1995, 2000, 2001 Software Foundation, Inc.
4
 
 
5
 
   This program is free software; you can redistribute it and/or modify it
6
 
   under the terms of the GNU Library General Public License as published
7
 
   by the Free Software Foundation; either version 2, or (at your option)
8
 
   any later version.
9
 
 
10
 
   This program is distributed in the hope that it will be useful,
11
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
   Library General Public License for more details.
14
 
 
15
 
   You should have received a copy of the GNU Library General Public
16
 
   License along with this program; if not, write to the Free Software
17
 
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18
 
   USA.  */
19
 
 
20
 
#ifdef HAVE_CONFIG_H
21
 
# include <config.h>
22
 
#endif
23
 
 
24
 
#include "libgnuintl.h"
25
 
#include "gettextP.h"
26
 
 
27
 
/* @@ end of prolog @@ */
28
 
 
29
 
/* This file redirects the gettext functions (without prefix or suffix) to
30
 
   those defined in the included GNU gettext library (with "__" suffix).
31
 
   It is compiled into libintl when the included GNU gettext library is
32
 
   configured --with-included-gettext.
33
 
 
34
 
   This redirection works also in the case that the system C library or
35
 
   the system libintl library contain gettext/textdomain/... functions.
36
 
   If it didn't, we would need to add preprocessor level redirections to
37
 
   libgnuintl.h of the following form:
38
 
 
39
 
#    define gettext gettext__
40
 
#    define dgettext dgettext__
41
 
#    define dcgettext dcgettext__
42
 
#    define ngettext ngettext__
43
 
#    define dngettext dngettext__
44
 
#    define dcngettext dcngettext__
45
 
#    define textdomain textdomain__
46
 
#    define bindtextdomain bindtextdomain__
47
 
#    define bind_textdomain_codeset bind_textdomain_codeset__
48
 
 
49
 
   How does this redirection work? There are two cases.
50
 
   A. When libintl.a is linked into an executable, it works because
51
 
      functions defined in the executable always override functions in
52
 
      the shared libraries.
53
 
   B. When libintl.so is used, it works because
54
 
      1. those systems defining gettext/textdomain/... in the C library
55
 
         (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are
56
 
         ELF systems and define these symbols as weak, thus explicitly
57
 
         letting other shared libraries override it.
58
 
      2. those systems defining gettext/textdomain/... in a standalone
59
 
         libintl.so library (namely, Solaris 2.3 and newer) have this
60
 
         shared library in /usr/lib, and the linker will search /usr/lib
61
 
         *after* the directory where the GNU gettext library is installed.
62
 
 
63
 
   A third case, namely when libintl.a is linked into a shared library
64
 
   whose name is not libintl.so, is not supported. In this case, on
65
 
   Solaris, when -lintl precedes the linker option for the shared library
66
 
   containing GNU gettext, the system's gettext would indeed override
67
 
   the GNU gettext. Anyone doing this kind of stuff must be clever enough
68
 
   to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker
69
 
   command line.  */
70
 
 
71
 
 
72
 
#undef gettext
73
 
#undef dgettext
74
 
#undef dcgettext
75
 
#undef ngettext
76
 
#undef dngettext
77
 
#undef dcngettext
78
 
#undef textdomain
79
 
#undef bindtextdomain
80
 
#undef bind_textdomain_codeset
81
 
 
82
 
 
83
 
char *
84
 
gettext (msgid)
85
 
     const char *msgid;
86
 
{
87
 
  return gettext__ (msgid);
88
 
}
89
 
 
90
 
 
91
 
char *
92
 
dgettext (domainname, msgid)
93
 
     const char *domainname;
94
 
     const char *msgid;
95
 
{
96
 
  return dgettext__ (domainname, msgid);
97
 
}
98
 
 
99
 
 
100
 
char *
101
 
dcgettext (domainname, msgid, category)
102
 
     const char *domainname;
103
 
     const char *msgid;
104
 
     int category;
105
 
{
106
 
  return dcgettext__ (domainname, msgid, category);
107
 
}
108
 
 
109
 
 
110
 
char *
111
 
ngettext (msgid1, msgid2, n)
112
 
     const char *msgid1;
113
 
     const char *msgid2;
114
 
     unsigned long int n;
115
 
{
116
 
  return ngettext__ (msgid1, msgid2, n);
117
 
}
118
 
 
119
 
 
120
 
char *
121
 
dngettext (domainname, msgid1, msgid2, n)
122
 
     const char *domainname;
123
 
     const char *msgid1;
124
 
     const char *msgid2;
125
 
     unsigned long int n;
126
 
{
127
 
  return dngettext__ (domainname, msgid1, msgid2, n);
128
 
}
129
 
 
130
 
 
131
 
char *
132
 
dcngettext (domainname, msgid1, msgid2, n, category)
133
 
     const char *domainname;
134
 
     const char *msgid1;
135
 
     const char *msgid2;
136
 
     unsigned long int n;
137
 
     int category;
138
 
{
139
 
  return dcngettext__ (domainname, msgid1, msgid2, n, category);
140
 
}
141
 
 
142
 
 
143
 
char *
144
 
textdomain (domainname)
145
 
     const char *domainname;
146
 
{
147
 
  return textdomain__ (domainname);
148
 
}
149
 
 
150
 
 
151
 
char *
152
 
bindtextdomain (domainname, dirname)
153
 
     const char *domainname;
154
 
     const char *dirname;
155
 
{
156
 
  return bindtextdomain__ (domainname, dirname);
157
 
}
158
 
 
159
 
 
160
 
char *
161
 
bind_textdomain_codeset (domainname, codeset)
162
 
     const char *domainname;
163
 
     const char *codeset;
164
 
{
165
 
  return bind_textdomain_codeset__ (domainname, codeset);
166
 
}