~ubuntu-branches/ubuntu/edgy/e2fsprogs/edgy-updates

« back to all changes in this revision

Viewing changes to intl/localcharset.c

  • Committer: Bazaar Package Importer
  • Author(s): Tollef Fog Heen
  • Date: 2005-08-23 10:42:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050823104210-t15igvmgrkzea0dq
Tags: 1.38-2ubuntu1
* Merge with Debian.  (Ubuntu #13757)
* Remove tests/f_bad_disconnected_inode/image.gz to be able to build the
  package.  This will (hopefully) be in the next upstream version and is
  just used for testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Determine a canonical name for the current locale's character encoding.
2
2
 
3
 
   Copyright (C) 2000-2002 Free Software Foundation, Inc.
 
3
   Copyright (C) 2000-2003 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify it
6
6
   under the terms of the GNU Library General Public License as published
23
23
# include <config.h>
24
24
#endif
25
25
 
 
26
/* Specification.  */
 
27
#include "localcharset.h"
 
28
 
26
29
#if HAVE_STDDEF_H
27
30
# include <stddef.h>
28
31
#endif
64
67
# include <os2.h>
65
68
#endif
66
69
 
 
70
#if ENABLE_RELOCATABLE
 
71
# include "relocatable.h"
 
72
#else
 
73
# define relocate(pathname) (pathname)
 
74
#endif
 
75
 
67
76
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
68
77
  /* Win32, OS/2, DOS */
69
78
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
77
86
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
78
87
#endif
79
88
 
80
 
#ifdef HAVE_GETC_UNLOCKED
 
89
#if HAVE_DECL_GETC_UNLOCKED
81
90
# undef getc
82
91
# define getc getc_unlocked
83
92
#endif
84
93
 
85
 
#ifdef __cplusplus
86
 
/* When compiling with "gcc -x c++", produce a function with C linkage.  */
87
 
extern "C" const char * locale_charset (void);
88
 
#endif
89
 
 
90
94
/* The following static variable is declared 'volatile' to avoid a
91
95
   possible multithread problem in the function get_charset_aliases. If we
92
96
   are running in a threaded environment, and if two threads initialize
110
114
  cp = charset_aliases;
111
115
  if (cp == NULL)
112
116
    {
113
 
#if !defined WIN32
 
117
#if !(defined VMS || defined WIN32)
114
118
      FILE *fp;
115
 
      const char *dir = LIBDIR;
 
119
      const char *dir = relocate (LIBDIR);
116
120
      const char *base = "charset.alias";
117
121
      char *file_name;
118
122
 
200
204
 
201
205
#else
202
206
 
 
207
# if defined VMS
 
208
      /* To avoid the troubles of an extra file charset.alias_vms in the
 
209
         sources of many GNU packages, simply inline the aliases here.  */
 
210
      /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
 
211
         "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
 
212
         section 10.7 "Handling Different Character Sets".  */
 
213
      cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
 
214
           "ISO8859-2" "\0" "ISO-8859-2" "\0"
 
215
           "ISO8859-5" "\0" "ISO-8859-5" "\0"
 
216
           "ISO8859-7" "\0" "ISO-8859-7" "\0"
 
217
           "ISO8859-8" "\0" "ISO-8859-8" "\0"
 
218
           "ISO8859-9" "\0" "ISO-8859-9" "\0"
 
219
           /* Japanese */
 
220
           "eucJP" "\0" "EUC-JP" "\0"
 
221
           "SJIS" "\0" "SHIFT_JIS" "\0"
 
222
           "DECKANJI" "\0" "DEC-KANJI" "\0"
 
223
           "SDECKANJI" "\0" "EUC-JP" "\0"
 
224
           /* Chinese */
 
225
           "eucTW" "\0" "EUC-TW" "\0"
 
226
           "DECHANYU" "\0" "DEC-HANYU" "\0"
 
227
           "DECHANZI" "\0" "GB2312" "\0"
 
228
           /* Korean */
 
229
           "DECKOREAN" "\0" "EUC-KR" "\0";
 
230
# endif
 
231
 
 
232
# if defined WIN32
203
233
      /* To avoid the troubles of installing a separate file in the same
204
234
         directory as the DLL and of retrieving the DLL's directory at
205
235
         runtime, simply inline the aliases here.  */
206
236
 
207
 
# if defined WIN32
208
237
      cp = "CP936" "\0" "GBK" "\0"
209
238
           "CP1361" "\0" "JOHAB" "\0"
210
239
           "CP20127" "\0" "ASCII" "\0"