~ubuntu-branches/ubuntu/saucy/groundhog/saucy

« back to all changes in this revision

Viewing changes to intl/l10nflist.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2003-06-18 19:46:15 UTC
  • mto: (2.1.1 warty)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20030618194615-sztk57bkfjhmctl4
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Handle list of needed message catalogs
2
 
   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
1
/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3
2
   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
4
3
 
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)
 
4
   This program is free software; you can redistribute it and/or modify it
 
5
   under the terms of the GNU Library General Public License as published
 
6
   by the Free Software Foundation; either version 2, or (at your option)
8
7
   any later version.
9
8
 
10
9
   This program is distributed in the hope that it will be useful,
11
10
   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.
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.  */
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public
 
15
   License along with this program; if not, write to the Free Software
 
16
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
17
   USA.  */
 
18
 
 
19
/* Tell glibc's <string.h> to provide a prototype for stpcpy().
 
20
   This must come before <config.h> because <config.h> may include
 
21
   <features.h>, and once <features.h> has been included, it's too late.  */
 
22
#ifndef _GNU_SOURCE
 
23
# define _GNU_SOURCE    1
 
24
#endif
18
25
 
19
26
#ifdef HAVE_CONFIG_H
20
27
# include <config.h>
21
28
#endif
22
29
 
23
 
 
24
 
#if defined HAVE_STRING_H || defined _LIBC
25
 
# ifndef _GNU_SOURCE
26
 
#  define _GNU_SOURCE   1
27
 
# endif
28
 
# include <string.h>
29
 
#else
30
 
# include <strings.h>
31
 
# ifndef memcpy
32
 
#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
33
 
# endif
34
 
#endif
35
 
#if !HAVE_STRCHR && !defined _LIBC
36
 
# ifndef strchr
37
 
#  define strchr index
38
 
# endif
39
 
#endif
 
30
#include <string.h>
40
31
 
41
32
#if defined _LIBC || defined HAVE_ARGZ_H
42
33
# include <argz.h>
43
34
#endif
44
35
#include <ctype.h>
45
36
#include <sys/types.h>
46
 
 
47
 
#if defined STDC_HEADERS || defined _LIBC
48
 
# include <stdlib.h>
49
 
#endif
 
37
#include <stdlib.h>
50
38
 
51
39
#include "loadinfo.h"
52
40
 
97
85
}
98
86
# undef __argz_count
99
87
# define __argz_count(argz, len) argz_count__ (argz, len)
 
88
#else
 
89
# ifdef _LIBC
 
90
#  define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
 
91
# endif
100
92
#endif  /* !_LIBC && !HAVE___ARGZ_COUNT */
101
93
 
102
94
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
121
113
}
122
114
# undef __argz_stringify
123
115
# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
 
116
#else
 
117
# ifdef _LIBC
 
118
#  define __argz_stringify(argz, len, sep) \
 
119
  INTUSE(__argz_stringify) (argz, len, sep)
 
120
# endif
124
121
#endif  /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
125
122
 
126
123
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
224
221
 
225
222
  /* Construct file name.  */
226
223
  memcpy (abs_filename, dirlist, dirlist_len);
227
 
  __argz_stringify (abs_filename, dirlist_len, ':');
 
224
  __argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR);
228
225
  cp = abs_filename + (dirlist_len - 1);
229
226
  *cp++ = '/';
230
227
  cp = stpcpy (cp, language);
349
346
 
350
347
/* Normalize codeset name.  There is no standard for the codeset
351
348
   names.  Normalization allows the user to use any of the common
352
 
   names.  */
 
349
   names.  The return value is dynamically allocated and has to be
 
350
   freed by the caller.  */
353
351
const char *
354
352
_nl_normalize_codeset (codeset, name_len)
355
 
     const unsigned char *codeset;
 
353
     const char *codeset;
356
354
     size_t name_len;
357
355
{
358
356
  int len = 0;
362
360
  size_t cnt;
363
361
 
364
362
  for (cnt = 0; cnt < name_len; ++cnt)
365
 
    if (isalnum (codeset[cnt]))
 
363
    if (isalnum ((unsigned char) codeset[cnt]))
366
364
      {
367
365
        ++len;
368
366
 
369
 
        if (isalpha (codeset[cnt]))
 
367
        if (isalpha ((unsigned char) codeset[cnt]))
370
368
          only_digit = 0;
371
369
      }
372
370
 
380
378
        wp = retval;
381
379
 
382
380
      for (cnt = 0; cnt < name_len; ++cnt)
383
 
        if (isalpha (codeset[cnt]))
384
 
          *wp++ = tolower (codeset[cnt]);
385
 
        else if (isdigit (codeset[cnt]))
 
381
        if (isalpha ((unsigned char) codeset[cnt]))
 
382
          *wp++ = tolower ((unsigned char) codeset[cnt]);
 
383
        else if (isdigit ((unsigned char) codeset[cnt]))
386
384
          *wp++ = codeset[cnt];
387
385
 
388
386
      *wp = '\0';