~ubuntu-branches/ubuntu/oneiric/groundhog/oneiric

« back to all changes in this revision

Viewing changes to intl/finddomain.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2004-08-20 23:12:32 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040820231232-18s0op2f9g21ag1z
Tags: 1.4-6
Update Policy Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Handle list of needed message catalogs
2
 
   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3
 
   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
2
   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
 
3
   Written by Ulrich Drepper <drepper@gnu.org>, 1995.
4
4
 
5
 
   This program is free software; you can redistribute it and/or modify
6
 
   it under the terms of the GNU General Public License as published by
7
 
   the Free Software Foundation; either version 2, or (at your option)
 
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
8
   any later version.
9
9
 
10
10
   This program is distributed in the hope that it will be useful,
11
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
   GNU General Public License for more details.
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
14
14
 
15
 
   You should have received a copy of the GNU General Public License
16
 
   along with this program; if not, write to the Free Software Foundation,
17
 
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
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.  */
18
19
 
19
20
#ifdef HAVE_CONFIG_H
20
21
# include <config.h>
21
22
#endif
22
23
 
23
 
#include <ctype.h>
24
 
#include <errno.h>
25
24
#include <stdio.h>
26
25
#include <sys/types.h>
27
 
 
28
 
#if defined STDC_HEADERS || defined _LIBC
29
 
# include <stdlib.h>
30
 
#else
31
 
# ifdef HAVE_MALLOC_H
32
 
#  include <malloc.h>
33
 
# else
34
 
void free ();
35
 
# endif
36
 
#endif
37
 
 
38
 
#if defined HAVE_STRING_H || defined _LIBC
39
 
# include <string.h>
40
 
#else
41
 
# include <strings.h>
42
 
# ifndef memcpy
43
 
#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
44
 
# endif
45
 
#endif
46
 
#if !HAVE_STRCHR && !defined _LIBC
47
 
# ifndef strchr
48
 
#  define strchr index
49
 
# endif
50
 
#endif
 
26
#include <stdlib.h>
 
27
#include <string.h>
51
28
 
52
29
#if defined HAVE_UNISTD_H || defined _LIBC
53
30
# include <unistd.h>
54
31
#endif
55
32
 
56
 
#include "gettext.h"
57
33
#include "gettextP.h"
58
34
#ifdef _LIBC
59
35
# include <libintl.h>
60
36
#else
61
 
# include "libgettext.h"
 
37
# include "libgnuintl.h"
62
38
#endif
63
39
 
64
40
/* @@ end of prolog @@ */
71
47
   established bindings.  */
72
48
struct loaded_l10nfile *
73
49
internal_function
74
 
_nl_find_domain (dirname, locale, domainname)
 
50
_nl_find_domain (dirname, locale, domainname, domainbinding)
75
51
     const char *dirname;
76
52
     char *locale;
77
53
     const char *domainname;
 
54
     struct binding *domainbinding;
78
55
{
79
56
  struct loaded_l10nfile *retval;
80
57
  const char *language;
120
97
      int cnt;
121
98
 
122
99
      if (retval->decided == 0)
123
 
        _nl_load_domain (retval);
 
100
        _nl_load_domain (retval, domainbinding);
124
101
 
125
102
      if (retval->data != NULL)
126
103
        return retval;
128
105
      for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
129
106
        {
130
107
          if (retval->successor[cnt]->decided == 0)
131
 
            _nl_load_domain (retval->successor[cnt]);
 
108
            _nl_load_domain (retval->successor[cnt], domainbinding);
132
109
 
133
110
          if (retval->successor[cnt]->data != NULL)
134
111
            break;
175
152
    return NULL;
176
153
 
177
154
  if (retval->decided == 0)
178
 
    _nl_load_domain (retval);
 
155
    _nl_load_domain (retval, domainbinding);
179
156
  if (retval->data == NULL)
180
157
    {
181
158
      int cnt;
182
159
      for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
183
160
        {
184
161
          if (retval->successor[cnt]->decided == 0)
185
 
            _nl_load_domain (retval->successor[cnt]);
 
162
            _nl_load_domain (retval->successor[cnt], domainbinding);
186
163
          if (retval->successor[cnt]->data != NULL)
187
164
            break;
188
165
        }
192
169
  if (alias_value != NULL)
193
170
    free (locale);
194
171
 
 
172
  /* The space for normalized_codeset is dynamically allocated.  Free it.  */
 
173
  if (mask & XPG_NORM_CODESET)
 
174
    free ((void *) normalized_codeset);
 
175
 
195
176
  return retval;
196
177
}
197
178
 
208
189
      if (runp->data != NULL)
209
190
        _nl_unload_domain ((struct loaded_domain *) runp->data);
210
191
      runp = runp->next;
 
192
      free ((char *) here->filename);
211
193
      free (here);
212
194
    }
213
195
}