diff options
author | Jim Meyering <jim@meyering.net> | 2002-11-23 14:59:39 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-11-23 14:59:39 +0000 |
commit | ba986c2928e90b6e30d90a69066e6ae077222fba (patch) | |
tree | 8532ee64a1486c823c2e3de259dbe951013d9353 | |
parent | 34c25ed945b375317ee4fbfb6cb5dfbea4d6fb9a (diff) | |
download | coreutils-ba986c2928e90b6e30d90a69066e6ae077222fba.tar.xz |
Update from gnulib.
-rwxr-xr-x | lib/config.charset | 66 | ||||
-rw-r--r-- | lib/localcharset.c | 30 | ||||
-rw-r--r-- | lib/mbswidth.c | 16 | ||||
-rw-r--r-- | lib/mbswidth.h | 14 |
4 files changed, 83 insertions, 43 deletions
diff --git a/lib/config.charset b/lib/config.charset index b91e0591b..4f98b5b0c 100755 --- a/lib/config.charset +++ b/lib/config.charset @@ -34,7 +34,7 @@ # ASCII, ANSI_X3.4-1968 glibc solaris freebsd # ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-3 glibc yes +# ISO-8859-3 glibc solaris yes # ISO-8859-4 osf solaris freebsd yes # ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-6 glibc aix hpux solaris yes @@ -42,9 +42,11 @@ # ISO-8859-8 glibc aix hpux osf solaris yes # ISO-8859-9 glibc aix hpux irix osf solaris yes # ISO-8859-13 glibc +# ISO-8859-14 glibc # ISO-8859-15 glibc aix osf solaris freebsd # KOI8-R glibc solaris freebsd yes # KOI8-U glibc freebsd yes +# KOI8-T glibc # CP437 dos # CP775 dos # CP850 aix osf dos @@ -58,35 +60,38 @@ # CP865 dos # CP866 freebsd dos # CP869 dos -# CP874 win32 dos +# CP874 woe32 dos # CP922 aix -# CP932 aix win32 dos +# CP932 aix woe32 dos # CP943 aix -# CP949 osf win32 dos -# CP950 win32 dos +# CP949 osf woe32 dos +# CP950 woe32 dos # CP1046 aix # CP1124 aix +# CP1125 dos # CP1129 aix -# CP1250 win32 -# CP1251 glibc win32 -# CP1252 aix win32 -# CP1253 win32 -# CP1254 win32 -# CP1255 win32 -# CP1256 win32 -# CP1257 win32 +# CP1250 woe32 +# CP1251 glibc woe32 +# CP1252 aix woe32 +# CP1253 woe32 +# CP1254 woe32 +# CP1255 glibc woe32 +# CP1256 woe32 +# CP1257 woe32 # GB2312 glibc aix hpux irix solaris freebsd yes # EUC-JP glibc aix hpux irix osf solaris freebsd yes # EUC-KR glibc aix hpux irix osf solaris freebsd yes # EUC-TW glibc aix hpux irix osf solaris # BIG5 glibc aix hpux osf solaris freebsd yes -# BIG5-HKSCS glibc -# GBK aix osf win32 dos -# GB18030 glibc +# BIG5-HKSCS glibc solaris +# GBK glibc aix osf solaris woe32 dos +# GB18030 glibc solaris # SHIFT_JIS hpux osf solaris freebsd yes -# JOHAB glibc win32 +# JOHAB glibc solaris woe32 # TIS-620 glibc aix hpux osf solaris # VISCII glibc yes +# TCVN5712-1 glibc +# GEORGIAN-PS glibc # HP-ROMAN8 hpux # HP-ARABIC8 hpux # HP-GREEK8 hpux @@ -217,6 +222,7 @@ case "$os" in echo "646 ASCII" echo "ISO8859-1 ISO-8859-1" echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-3 ISO-8859-3" echo "ISO8859-4 ISO-8859-4" echo "ISO8859-5 ISO-8859-5" echo "ISO8859-6 ISO-8859-6" @@ -226,9 +232,13 @@ case "$os" in echo "ISO8859-15 ISO-8859-15" echo "koi8-r KOI8-R" echo "BIG5 BIG5" + echo "Big5-HKSCS BIG5-HKSCS" echo "gb2312 GB2312" + echo "GBK GBK" + echo "GB18030 GB18030" echo "cns11643 EUC-TW" echo "5601 EUC-KR" + echo "ko_KR.johap92 JOHAB" echo "eucJP EUC-JP" echo "PCK SHIFT_JIS" echo "TIS620.2533 TIS-620" @@ -272,6 +282,20 @@ case "$os" in echo "ja_JP.Shift_JIS SHIFT_JIS" echo "ko_KR.EUC EUC-KR" ;; + netbsd*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-15 ISO-8859-15" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "BIG5 BIG5" + echo "SJIS SHIFT_JIS" + ;; beos*) # BeOS has a single locale, and it has UTF-8 encoding. echo "* UTF-8" @@ -286,7 +310,7 @@ case "$os" in echo "# country is not the one your DOS machine actually uses, just" echo "# correct it in this file, and send a mail to" echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>" - echo "# and Bruno Haible <haible@clisp.cons.org>." + echo "# and Bruno Haible <bruno@clisp.org>." echo "#" echo "C ASCII" # ISO-8859-1 languages @@ -396,8 +420,10 @@ case "$os" in echo "bg_BG CP866" # not CP855 ?? echo "mk CP866" # not CP855 ?? echo "mk_MK CP866" # not CP855 ?? - echo "ru KOI8-R" # not CP866 ?? - echo "ru_RU KOI8-R" # not CP866 ?? + echo "ru CP866" + echo "ru_RU CP866" + echo "uk CP1125" + echo "uk_UA CP1125" # ISO-8859-6 languages echo "ar CP864" echo "ar_AE CP864" diff --git a/lib/localcharset.c b/lib/localcharset.c index bc5587bf6..2b1564e2f 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Written by Bruno Haible <haible@clisp.cons.org>. */ +/* Written by Bruno Haible <bruno@clisp.org>. */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -82,6 +82,11 @@ # define getc getc_unlocked #endif +#ifdef __cplusplus +/* When compiling with "gcc -x c++", produce a function with C linkage. */ +extern "C" const char * locale_charset (void); +#endif + /* The following static variable is declared 'volatile' to avoid a possible multithread problem in the function get_charset_aliases. If we are running in a threaded environment, and if two threads initialize @@ -201,7 +206,20 @@ get_charset_aliases () # if defined WIN32 cp = "CP936" "\0" "GBK" "\0" - "CP1361" "\0" "JOHAB" "\0"; + "CP1361" "\0" "JOHAB" "\0" + "CP20127" "\0" "ASCII" "\0" + "CP20866" "\0" "KOI8-R" "\0" + "CP21866" "\0" "KOI8-RU" "\0" + "CP28591" "\0" "ISO-8859-1" "\0" + "CP28592" "\0" "ISO-8859-2" "\0" + "CP28593" "\0" "ISO-8859-3" "\0" + "CP28594" "\0" "ISO-8859-4" "\0" + "CP28595" "\0" "ISO-8859-5" "\0" + "CP28596" "\0" "ISO-8859-6" "\0" + "CP28597" "\0" "ISO-8859-7" "\0" + "CP28598" "\0" "ISO-8859-8" "\0" + "CP28599" "\0" "ISO-8859-9" "\0" + "CP28605" "\0" "ISO-8859-15" "\0"; # endif #endif @@ -267,7 +285,7 @@ locale_charset () static char buf[2 + 10 + 1]; - /* Win32 has a function returning the locale's codepage as a number. */ + /* Woe32 has a function returning the locale's codepage as a number. */ sprintf (buf, "CP%u", GetACP ()); codeset = buf; @@ -341,5 +359,11 @@ locale_charset () break; } + /* Don't return an empty string. GNU libc and GNU libiconv interpret + the empty string as denoting "the locale's character encoding", + thus GNU libiconv would call this function a second time. */ + if (codeset[0] == '\0') + codeset = "ASCII"; + return codeset; } diff --git a/lib/mbswidth.c b/lib/mbswidth.c index 69a801cea..a2ef5b3fd 100644 --- a/lib/mbswidth.c +++ b/lib/mbswidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a string. - Copyright (C) 2000-2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -21,6 +21,9 @@ # include <config.h> #endif +/* Specification. */ +#include "mbswidth.h" + /* Get MB_CUR_MAX. */ #include <stdlib.h> @@ -78,17 +81,13 @@ int wcwidth (); #undef ISCNTRL #define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) -#include "mbswidth.h" - /* Returns the number of columns needed to represent the multibyte character string pointed to by STRING. If a non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is the multibyte analogon of the wcswidth function. */ int -mbswidth (string, flags) - const char *string; - int flags; +mbswidth (const char *string, int flags) { return mbsnwidth (string, strlen (string), flags); } @@ -98,10 +97,7 @@ mbswidth (string, flags) non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. */ int -mbsnwidth (string, nbytes, flags) - const char *string; - size_t nbytes; - int flags; +mbsnwidth (const char *string, size_t nbytes, int flags) { const char *p = string; const char *plimit = p + nbytes; diff --git a/lib/mbswidth.h b/lib/mbswidth.h index 38911da00..40d4cba04 100644 --- a/lib/mbswidth.h +++ b/lib/mbswidth.h @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a string. - Copyright (C) 2000-2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -15,13 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef PARAMS -# if defined (__GNUC__) || __STDC__ -# define PARAMS(Args) Args -# else -# define PARAMS(Args) () -# endif -#endif +#include <stddef.h> /* Optional flags to influence mbswidth/mbsnwidth behavior. */ @@ -36,8 +30,8 @@ /* Returns the number of screen columns needed for STRING. */ #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ -extern int mbswidth PARAMS ((const char *string, int flags)); +extern int mbswidth (const char *string, int flags); /* Returns the number of screen columns needed for the NBYTES bytes starting at BUF. */ -extern int mbsnwidth PARAMS ((const char *buf, size_t nbytes, int flags)); +extern int mbsnwidth (const char *buf, size_t nbytes, int flags); |