summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwl <wl>2006-01-10 09:43:43 +0000
committerwl <wl>2006-01-10 09:43:43 +0000
commit277273f8a652d7ffbb483590caebe4f509575ce2 (patch)
treeeb6a7a985b490bca3c5146f624622745bef1a4d1
parent3c937d410b08b3a55a6b91ca18cf6f0c0f1139bf (diff)
downloadgroff-277273f8a652d7ffbb483590caebe4f509575ce2.tar.gz
Work around unportability of nl_langinfo(CODESET).
* m4/glibc21.m4: New file, from gnulib. * Makefile.sub (M4MACROS): Add m4/glibc21.m4. * configure.ac: Also test for stddef.h, and invoke jm_GLIBC21. * Makefile.in (HOST, GLIBC21): New variables. (MDEFINES): Pass them to subdirectories. * src/include/relocate.h (relocatep): Define with C linkage. * src/include/localcharset.h: New file, from gnulib. * src/libs/libgroff/localcharset.c: New file, from gnulib with a modification for relocate(). * src/libs/libgroff/config.charset: New file, from gnulib. * src/libs/libgroff/ref-add.sin: New file, from gnulib. * src/libs/libgroff/ref-del.sin: New file, from gnulib. * src/libs/libgroff/Makefile.sub (EXTRA_CFLAGS): Also define LIBDIR. (OBJS): Add localcharset.o. (CSRCS): Add localcharset.c. (all): Add dependencies to charset.alias, ref-add.sed, ref-del.sed. (charset.alias): New rule. (PACKAGE): New variable. (ref-add.sed, ref-del.sed): New rules. (MKINSTALLDIRS): New variable. (install_data): Depend on install_charset_data. (install_charset_data): New rule for creating or updating charset.alias. (uninstall_sub): Depend on uninstall_charset_data. (uninstall_charset_data): New rule for uninstalling or updating charset.alias. * src/preproc/preconv/preconv.cpp: Include localcharset.h instead of <langinfo.h>. (main): Initialize default_encoding from locale_charset() instead of nl_langinfo(CODESET). * aclocal.m4, configure, src/include/config.hin: Regenerated.
-rw-r--r--ChangeLog37
-rw-r--r--Makefile.in44
-rw-r--r--Makefile.sub2
-rw-r--r--aclocal.m41
-rwxr-xr-xconfigure44
-rw-r--r--configure.ac5
-rw-r--r--m4/glibc21.m432
-rw-r--r--src/include/config.hin3
-rw-r--r--src/include/localcharset.h42
-rw-r--r--src/include/relocate.h14
-rw-r--r--src/libs/libgroff/Makefile.sub64
-rwxr-xr-xsrc/libs/libgroff/config.charset638
-rw-r--r--src/libs/libgroff/localcharset.c416
-rw-r--r--src/libs/libgroff/ref-add.sin31
-rw-r--r--src/libs/libgroff/ref-del.sin26
-rw-r--r--src/preproc/preconv/preconv.cpp16
16 files changed, 1383 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index e19bba15..bb3dc1c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2006-01-10 Bruno Haible <bruno@clisp.org>
+
+ Work around unportability of nl_langinfo(CODESET).
+
+ * m4/glibc21.m4: New file, from gnulib.
+ * Makefile.sub (M4MACROS): Add m4/glibc21.m4.
+ * configure.ac: Also test for stddef.h, and invoke jm_GLIBC21.
+ * Makefile.in (HOST, GLIBC21): New variables.
+ (MDEFINES): Pass them to subdirectories.
+ * src/include/relocate.h (relocatep): Define with C linkage.
+ * src/include/localcharset.h: New file, from gnulib.
+ * src/libs/libgroff/localcharset.c: New file, from gnulib with a
+ modification for relocate().
+ * src/libs/libgroff/config.charset: New file, from gnulib.
+ * src/libs/libgroff/ref-add.sin: New file, from gnulib.
+ * src/libs/libgroff/ref-del.sin: New file, from gnulib.
+ * src/libs/libgroff/Makefile.sub (EXTRA_CFLAGS): Also define LIBDIR.
+ (OBJS): Add localcharset.o.
+ (CSRCS): Add localcharset.c.
+ (all): Add dependencies to charset.alias, ref-add.sed, ref-del.sed.
+ (charset.alias): New rule.
+ (PACKAGE): New variable.
+ (ref-add.sed, ref-del.sed): New rules.
+ (MKINSTALLDIRS): New variable.
+ (install_data): Depend on install_charset_data.
+ (install_charset_data): New rule for creating or updating
+ charset.alias.
+ (uninstall_sub): Depend on uninstall_charset_data.
+ (uninstall_charset_data): New rule for uninstalling or updating
+ charset.alias.
+ * src/preproc/preconv/preconv.cpp: Include localcharset.h instead
+ of <langinfo.h>.
+ (main): Initialize default_encoding from locale_charset() instead of
+ nl_langinfo(CODESET).
+
+ * aclocal.m4, configure, src/include/config.hin: Regenerated.
+
2006-01-10 Werner LEMBERG <wl@gnu.org>
* src/preproc/preconv/preconv.cpp (conversion_iconv): Use
diff --git a/Makefile.in b/Makefile.in
index 57160d06..ebc2c6e9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -25,6 +25,12 @@ top_srcdir=@abs_top_srcdir@
VPATH=@srcdir@
top_builddir=@abs_top_builddir@
+# `HOST' is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+HOST=@host@
+
# `RT_SEP' is the operating system's native PATH SEPARATOR CHAR, which
# is to be used in runtime PATHs compiled into groff executables.
RT_SEP=@GROFF_PATH_SEPARATOR@
@@ -34,6 +40,10 @@ RT_SEP=@GROFF_PATH_SEPARATOR@
# particularly in some Microsoft environments, it may differ.
SH_SEP=@PATH_SEPARATOR@
+# `GLIBC21' is yes if the host operating system uses GNU libc 2.1 or newer,
+# otherwise no.
+GLIBC21=@GLIBC21@
+
version=`cat $(top_srcdir)/VERSION`
# No additional number if revision is zero.
revision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
@@ -253,26 +263,30 @@ make_install_pdfdoc=@make_install_pdfdoc@
# DEFINES should include the following:
#
# -DWORDS_BIGENDIAN if your target platform is big-endian
+# -DIS_EBCDIC_HOST if the host's encoding is EBCDIC
#
-# -DHAVE_MMAP if you have mmap() and <sys/mman.h>
-# -DARRAY_DELETE_NEEDS_SIZE if your C++ doesn't understand `delete []'
-# -DSYS_SIGLIST_DECLARED if you have sys_siglist[]
+# -DHAVE_DECL_SYS_SIGLIST if you have sys_siglist[]
# -DWCOREFLAG=0200 if the 0200 bit of the status returned by
# wait() indicates whether a core image was
# produced for a process that was terminated
# by a signal
#
+# -DHAVE_DIRECT_H if you have <direct.h>
# -DHAVE_DIRENT_H if you have <dirent.h>
+# -DHAVE_CC_INTTYPES_H if you have a C++ <inttypes.h>
+# -DHAVE_PROCESS_H if you have <process.h>
# -DHAVE_LIMITS_H if you have <limits.h>
# -DHAVE_CC_LIMITS_H if you have a C++ <limits.h>
# -DHAVE_MATH_H if you have <math.h>
# -DHAVE_CC_OSFCN_H if you have a C++ <osfcn.h>
-# -DHAVE_CC_INTTYPES_H if you have a C++ <inttypes.h>
+# -DHAVE_STDDEF_H if you have <stddef.h>
# -DHAVE_STDLIB_H if you have <stdlib.h>
# -DHAVE_STRING_H if you have <string.h>
# -DHAVE_STRINGS_H if you have <strings.h>
# -DHAVE_SYS_DIR_H if you have <sys/dir.h>
+# -DHAVE_SYS_STAT_H if you have <sys/stat.h>
# -DHAVE_SYS_TIME_H if you have <sys/time.h>
+# -DHAVE_SYS_TYPES_H if you have <sys/types.h>
# -DHAVE_UNISTD_H if you have <unistd.h>
#
# -DHAVE_FMOD if you have fmod()
@@ -307,7 +321,7 @@ make_install_pdfdoc=@make_install_pdfdoc@
# -DNEED_DECLARATION_SNPRINTF if your C++ <stdio.h> doesn't declare
# snprintf()
# -DNEED_DECLARATION_SRAND if your C++ <stdlib.h> doesn't declare srand()
-# -DNEED_DECLARATION_STRCASECMP if your C++ <string.h> doesn't declare
+# -DNEED_DECLARATION_STRCASECMP if your C++ <string.h> doesn't declare
# strcasecmp()
# -DNEED_DECLARATION_STRNCASECMP
# if your C++ <string.h> doesn't declare
@@ -317,20 +331,26 @@ make_install_pdfdoc=@make_install_pdfdoc@
# -DNEED_DECLARATION_VSNPRINTF if your C++ <stdio.h> doesn't declare
# vsnprintf()
#
-# -DRET_TYPE_SRAND_IS_VOID if srand() returns void not int
+# -DHAVE_STRUCT_EXCEPTION if <math.h> defines struct exception
# -DHAVE_SYS_NERR if you have sysnerr in <errno.h> or <stdio.h>
# -DHAVE_SYS_ERRLIST if you have sys_errlist in <errno.h> or
# <stdio.h>
-# -DTRADITIONAL_CPP if your C++ compiler uses a traditional
-# (Reiser) preprocessor
+# -DICONV_CONST=const if declaration of iconv() needs const
# -DLONG_FOR_TIME_T if localtime() takes a long * not a time_t *
-# -DHAVE_STRUCT_EXCEPTION if <math.h> defines struct exception
# -DRETSIGTYPE=int if signal handlers return int not void
-# -DICONV_CONST=const if declaration of iconv() needs const
-# -DIS_EBCDIC_HOST if the host's encoding is EBCDIC
+# -DRET_TYPE_SRAND_IS_VOID if srand() returns void not int
+#
+# -Duintmax_t=<value> define to `unsigned long' or `unsigned long
+# long' if <inttypes.h> does not exist
+#
+# -DTRADITIONAL_CPP if your C++ compiler uses a traditional
+# (Reiser) preprocessor
+# -DARRAY_DELETE_NEEDS_SIZE if your C++ doesn't understand `delete []'
+#
# -DPAGE=A4 if the the printer's page size is A4
# -DGHOSTSCRIPT=gs the name (and directory if required) of the
# ghostscript program
+#
DEFINES=@DEFS@
# Include
@@ -420,6 +440,8 @@ MDEFINES= \
"ETAGSCCFLAG=$(ETAGSCCFLAG)" \
"ETAGSFLAGS=$(ETAGSFLAGS)" \
"EXEEXT=$(EXEEXT)" \
+ "GLIBC21=$(GLIBC21)" \
+ "HOST=$(HOST)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_INFO=$(INSTALL_INFO)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
diff --git a/Makefile.sub b/Makefile.sub
index 26dfda11..ddb18fcf 100644
--- a/Makefile.sub
+++ b/Makefile.sub
@@ -14,7 +14,7 @@ CLEANADD=Makefile.cfg conftest*
M4MACROS = \
$(srcdir)/m4/groff.m4 \
- $(srcdir)/m4/codeset.m4 \
+ $(srcdir)/m4/codeset.m4 $(srcdir)/m4/glibc21.m4 \
$(srcdir)/m4/iconv.m4 \
$(srcdir)/m4/lib-link.m4 $(srcdir)/m4/lib-ld.m4 $(srcdir)/m4/lib-prefix.m4
diff --git a/aclocal.m4 b/aclocal.m4
index 705b6d91..2c0b0ed6 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -12,6 +12,7 @@
# PARTICULAR PURPOSE.
m4_include([m4/codeset.m4])
+m4_include([m4/glibc21.m4])
m4_include([m4/groff.m4])
m4_include([m4/iconv.m4])
m4_include([m4/lib-ld.m4])
diff --git a/configure b/configure
index deaee51b..ae737aaa 100755
--- a/configure
+++ b/configure
@@ -540,7 +540,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS XDEVDIRS XPROGDIRS XLIBDIRS appresdir LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC MAKEINFO RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD GREP EGREP LIBC LIBM build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBICONV LTLIBICONV LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap GROFF_PATH_SEPARATOR ALT_GHOSTSCRIPT_PROGS GHOSTSCRIPT ac_ct_GHOSTSCRIPT pnmcut pnmcrop pnmtopng psselect pnmtops make_html make_install_html ALT_AWK_PROGS AWK ac_ct_AWK make_pdfdoc make_install_pdfdoc pnmtops_nosetpage LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS XDEVDIRS XPROGDIRS XLIBDIRS appresdir LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC MAKEINFO RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD GREP EGREP LIBC LIBM build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBICONV LTLIBICONV LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap GROFF_PATH_SEPARATOR ALT_GHOSTSCRIPT_PROGS GHOSTSCRIPT ac_ct_GHOSTSCRIPT pnmcut pnmcrop pnmtopng psselect pnmtops make_html make_install_html ALT_AWK_PROGS AWK ac_ct_AWK make_pdfdoc make_install_pdfdoc pnmtops_nosetpage GLIBC21 LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -6296,7 +6296,8 @@ done
-for ac_header in stdlib.h unistd.h dirent.h limits.h sys/dir.h \
+
+for ac_header in stddef.h stdlib.h unistd.h dirent.h limits.h sys/dir.h \
string.h strings.h math.h sys/time.h direct.h process.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -11721,6 +11722,44 @@ echo "${ECHO_T}no" >&6
fi
+ echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5
+echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6
+if test "${ac_cv_gnu_library_2_1+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+ Lucky GNU user
+ #endif
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "Lucky GNU user" >/dev/null 2>&1; then
+ ac_cv_gnu_library_2_1=yes
+else
+ ac_cv_gnu_library_2_1=no
+fi
+rm -f conftest*
+
+
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5
+echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6
+
+ GLIBC21="$ac_cv_gnu_library_2_1"
+
+
+
ac_config_files="$ac_config_files stamp-h"
ac_config_files="$ac_config_files Makefile doc/Makefile src/utils/xtotroff/Makefile"
@@ -12406,6 +12445,7 @@ s,@ac_ct_AWK@,$ac_ct_AWK,;t t
s,@make_pdfdoc@,$make_pdfdoc,;t t
s,@make_install_pdfdoc@,$make_install_pdfdoc,;t t
s,@pnmtops_nosetpage@,$pnmtops_nosetpage,;t t
+s,@GLIBC21@,$GLIBC21,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/configure.ac b/configure.ac
index beaaba8b..36e120dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# Autoconf configuration file for groff.
-# Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1989-1995, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is part of groff.
@@ -51,7 +51,7 @@ GROFF_CSH_HACK([SH_SCRIPT_SED_CMD='1s/.*/:/'], [SH_SCRIPT_SED_CMD='1s/a/a/'])
AC_SUBST([SH_SCRIPT_SED_CMD])
# checks for headers
-AC_CHECK_HEADERS([stdlib.h unistd.h dirent.h limits.h sys/dir.h \
+AC_CHECK_HEADERS([stddef.h stdlib.h unistd.h dirent.h limits.h sys/dir.h \
string.h strings.h math.h sys/time.h direct.h process.h])
GROFF_ISC_SYSV3
GROFF_POSIX
@@ -121,6 +121,7 @@ GROFF_TARGET_PATH_SEPARATOR
GROFF_HTML_PROGRAMS
GROFF_PDFDOC_PROGRAMS
GROFF_PNMTOPS_NOSETPAGE
+jm_GLIBC21
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_CONFIG_FILES([Makefile doc/Makefile src/utils/xtotroff/Makefile])
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
new file mode 100644
index 00000000..9c9f3db3
--- /dev/null
+++ b/m4/glibc21.m4
@@ -0,0 +1,32 @@
+# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([jm_GLIBC21],
+ [
+ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+ ac_cv_gnu_library_2_1,
+ [AC_EGREP_CPP([Lucky GNU user],
+ [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+ Lucky GNU user
+ #endif
+#endif
+ ],
+ ac_cv_gnu_library_2_1=yes,
+ ac_cv_gnu_library_2_1=no)
+ ]
+ )
+ AC_SUBST(GLIBC21)
+ GLIBC21="$ac_cv_gnu_library_2_1"
+ ]
+)
diff --git a/src/include/config.hin b/src/include/config.hin
index 9c6d5ee2..72606334 100644
--- a/src/include/config.hin
+++ b/src/include/config.hin
@@ -79,6 +79,9 @@
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/src/include/localcharset.h b/src/include/localcharset.h
new file mode 100644
index 00000000..129e4a4a
--- /dev/null
+++ b/src/include/localcharset.h
@@ -0,0 +1,42 @@
+/* Determine a canonical name for the current locale's character encoding.
+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
+ This file is part of the GNU CHARSET Library.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+#ifndef _LOCALCHARSET_H
+#define _LOCALCHARSET_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+ into one of the canonical names listed in config.charset.
+ The result must not be freed; it is statically allocated.
+ If the canonical name cannot be determined, the result is a non-canonical
+ name. */
+extern const char * locale_charset (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LOCALCHARSET_H */
diff --git a/src/include/relocate.h b/src/include/relocate.h
index 0d9edc4c..51f48950 100644
--- a/src/include/relocate.h
+++ b/src/include/relocate.h
@@ -1,6 +1,5 @@
-// -*- C++ -*-
/* Provide relocation for macro and font files.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -17,11 +16,22 @@
Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301,
USA. */
+#ifdef __cplusplus
extern char *curr_prefix;
extern size_t curr_prefix_len;
void set_current_prefix ();
char *xdirname (char *s);
char *searchpath (const char *name, const char *pathp);
+#endif
+
+/* This function has C linkage. */
+extern
+#ifdef __cplusplus
+"C"
+#endif
char *relocatep (const char *path);
+
+#ifdef __cplusplus
char *relocate (const char *path);
+#endif
diff --git a/src/libs/libgroff/Makefile.sub b/src/libs/libgroff/Makefile.sub
index e7606a82..1b55fdb0 100644
--- a/src/libs/libgroff/Makefile.sub
+++ b/src/libs/libgroff/Makefile.sub
@@ -1,5 +1,5 @@
LIB=groff
-EXTRA_CFLAGS=-D__GETOPT_PREFIX=groff_
+EXTRA_CFLAGS=-D__GETOPT_PREFIX=groff_ -DLIBDIR=\"$(libdir)\"
OBJS=\
assert.$(OBJEXT) \
change_lf.$(OBJEXT) \
@@ -24,6 +24,7 @@ OBJS=\
itoa.$(OBJEXT) \
lf.$(OBJEXT) \
lineno.$(OBJEXT) \
+ localcharset.$(OBJEXT) \
macropath.$(OBJEXT) \
matherr.$(OBJEXT) \
maxfilename.$(OBJEXT) \
@@ -97,6 +98,7 @@ CSRCS=\
$(srcdir)/getopt1.c \
$(srcdir)/iftoa.c \
$(srcdir)/itoa.c \
+ $(srcdir)/localcharset.c \
$(srcdir)/matherr.c \
$(srcdir)/progname.c \
$(srcdir)/putenv.c \
@@ -124,3 +126,63 @@ version.cpp: $(top_srcdir)/VERSION $(top_srcdir)/REVISION
snprintf.$(OBJEXT): $(srcdir)/../snprintf/snprintf.c
$(CC) -c $(CDEFINES) $(CFLAGS) $(CPPFLAGS) \
$(srcdir)/../snprintf/snprintf.c
+
+# Data for localcharset.c. Taken from libiconv/libcharset.
+
+all: charset.alias ref-add.sed ref-del.sed
+
+charset.alias: $(srcdir)/config.charset
+ $(SHELL) $(srcdir)/config.charset '$(HOST)' > t-$@
+ mv t-$@ $@
+
+PACKAGE=groff
+
+ref-add.sed : $(srcdir)/ref-add.sin
+ sed -e '/^#/d' \
+ -e 's/@''PACKAGE''@/$(PACKAGE)/g' $(srcdir)/ref-add.sin > t-$@
+ mv t-$@ $@
+
+ref-del.sed : $(srcdir)/ref-del.sin
+ sed -e '/^#/d' \
+ -e 's/@''PACKAGE''@/$(PACKAGE)/g' $(srcdir)/ref-del.sin > t-$@
+ mv t-$@ $@
+
+MKINSTALLDIRS = $(SHELL) $(top_srcdir)/mkinstalldirs
+
+install_data: install_charset_data
+install_charset_data:
+ test $(GLIBC21) != no || $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
+ sed -f ref-add.sed $(DESTDIR)$(libdir)/charset.alias \
+ > $(DESTDIR)$(libdir)/t-charset.alias; \
+ $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias \
+ $(DESTDIR)$(libdir)/charset.alias; \
+ rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
+ else \
+ if test $(GLIBC21) = no; then \
+ sed -f ref-add.sed charset.alias \
+ > $(DESTDIR)$(libdir)/t-charset.alias; \
+ $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias \
+ $(DESTDIR)$(libdir)/charset.alias; \
+ rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
+ fi; \
+ fi
+
+uninstall_sub: uninstall_charset_data
+uninstall_charset_data:
+ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
+ sed -f ref-del.sed $(DESTDIR)$(libdir)/charset.alias \
+ > $(DESTDIR)$(libdir)/t-charset.alias; \
+ if grep '^# Packages using this file: $$' \
+ $(DESTDIR)$(libdir)/t-charset.alias > /dev/null; then \
+ rm -f $(DESTDIR)$(libdir)/charset.alias; \
+ else \
+ $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias \
+ $(DESTDIR)$(libdir)/charset.alias; \
+ fi; \
+ rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
+ fi
+
+clean: clean_charset
+clean_charset:
+ rm -f charset.alias ref-add.sed ref-del.sed
diff --git a/src/libs/libgroff/config.charset b/src/libs/libgroff/config.charset
new file mode 100755
index 00000000..9090c803
--- /dev/null
+++ b/src/libs/libgroff/config.charset
@@ -0,0 +1,638 @@
+#! /bin/sh
+# Output a system dependent table of character encoding aliases.
+#
+# Copyright (C) 2000-2004 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+#
+# The table consists of lines of the form
+# ALIAS CANONICAL
+#
+# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
+# ALIAS is compared in a case sensitive way.
+#
+# CANONICAL is the GNU canonical name for this character encoding.
+# It must be an encoding supported by libiconv. Support by GNU libc is
+# also desirable. CANONICAL is case insensitive. Usually an upper case
+# MIME charset name is preferred.
+# The current list of GNU canonical charset names is as follows.
+#
+# name MIME? used by which systems
+# ASCII, ANSI_X3.4-1968 glibc solaris freebsd darwin
+# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd darwin
+# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd darwin
+# ISO-8859-3 Y glibc solaris
+# ISO-8859-4 Y osf solaris freebsd darwin
+# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd darwin
+# ISO-8859-6 Y glibc aix hpux solaris
+# ISO-8859-7 Y glibc aix hpux irix osf solaris darwin
+# ISO-8859-8 Y glibc aix hpux osf solaris
+# ISO-8859-9 Y glibc aix hpux irix osf solaris darwin
+# ISO-8859-13 glibc darwin
+# ISO-8859-14 glibc
+# ISO-8859-15 glibc aix osf solaris freebsd darwin
+# KOI8-R Y glibc solaris freebsd darwin
+# KOI8-U Y glibc freebsd darwin
+# KOI8-T glibc
+# CP437 dos
+# CP775 dos
+# CP850 aix osf dos
+# CP852 dos
+# CP855 dos
+# CP856 aix
+# CP857 dos
+# CP861 dos
+# CP862 dos
+# CP864 dos
+# CP865 dos
+# CP866 freebsd darwin dos
+# CP869 dos
+# CP874 woe32 dos
+# CP922 aix
+# CP932 aix woe32 dos
+# CP943 aix
+# CP949 osf woe32 dos
+# CP950 woe32 dos
+# CP1046 aix
+# CP1124 aix
+# CP1125 dos
+# CP1129 aix
+# CP1250 woe32
+# CP1251 glibc solaris darwin woe32
+# CP1252 aix woe32
+# CP1253 woe32
+# CP1254 woe32
+# CP1255 glibc woe32
+# CP1256 woe32
+# CP1257 woe32
+# GB2312 Y glibc aix hpux irix solaris freebsd darwin
+# EUC-JP Y glibc aix hpux irix osf solaris freebsd darwin
+# EUC-KR Y glibc aix hpux irix osf solaris freebsd darwin
+# EUC-TW glibc aix hpux irix osf solaris
+# BIG5 Y glibc aix hpux osf solaris freebsd darwin
+# BIG5-HKSCS glibc solaris
+# GBK glibc aix osf solaris woe32 dos
+# GB18030 glibc solaris
+# SHIFT_JIS Y hpux osf solaris freebsd darwin
+# JOHAB glibc solaris woe32
+# TIS-620 glibc aix hpux osf solaris
+# VISCII Y glibc
+# TCVN5712-1 glibc
+# GEORGIAN-PS glibc
+# HP-ROMAN8 hpux
+# HP-ARABIC8 hpux
+# HP-GREEK8 hpux
+# HP-HEBREW8 hpux
+# HP-TURKISH8 hpux
+# HP-KANA8 hpux
+# DEC-KANJI osf
+# DEC-HANYU osf
+# UTF-8 Y glibc aix hpux osf solaris darwin
+#
+# Note: Names which are not marked as being a MIME name should not be used in
+# Internet protocols for information interchange (mail, news, etc.).
+#
+# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
+# must understand both names and treat them as equivalent.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+
+host="$1"
+os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
+echo "# This file contains a table of character encoding aliases,"
+echo "# suitable for operating system '${os}'."
+echo "# It was automatically generated from config.charset."
+# List of references, updated during installation:
+echo "# Packages using this file: "
+case "$os" in
+ linux-gnulibc1*)
+ # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
+ # localcharset.c falls back to using the full locale name
+ # from the environment variables.
+ echo "C ASCII"
+ echo "POSIX ASCII"
+ for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
+ en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
+ en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
+ es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
+ et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
+ fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
+ it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
+ sv_FI sv_SE; do
+ echo "$l ISO-8859-1"
+ echo "$l.iso-8859-1 ISO-8859-1"
+ echo "$l.iso-8859-15 ISO-8859-15"
+ echo "$l.iso-8859-15@euro ISO-8859-15"
+ echo "$l@euro ISO-8859-15"
+ echo "$l.cp-437 CP437"
+ echo "$l.cp-850 CP850"
+ echo "$l.cp-1252 CP1252"
+ echo "$l.cp-1252@euro CP1252"
+ #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
+ echo "$l.utf-8 UTF-8"
+ echo "$l.utf-8@euro UTF-8"
+ done
+ for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
+ sl_SI sr sr_CS sr_YU; do
+ echo "$l ISO-8859-2"
+ echo "$l.iso-8859-2 ISO-8859-2"
+ echo "$l.cp-852 CP852"
+ echo "$l.cp-1250 CP1250"
+ echo "$l.utf-8 UTF-8"
+ done
+ for l in mk mk_MK ru ru_RU; do
+ echo "$l ISO-8859-5"
+ echo "$l.iso-8859-5 ISO-8859-5"
+ echo "$l.koi8-r KOI8-R"
+ echo "$l.cp-866 CP866"
+ echo "$l.cp-1251 CP1251"
+ echo "$l.utf-8 UTF-8"
+ done
+ for l in ar ar_SA; do
+ echo "$l ISO-8859-6"
+ echo "$l.iso-8859-6 ISO-8859-6"
+ echo "$l.cp-864 CP864"
+ #echo "$l.cp-868 CP868" # not a commonly used encoding
+ echo "$l.cp-1256 CP1256"
+ echo "$l.utf-8 UTF-8"
+ done
+ for l in el el_GR gr gr_GR; do
+ echo "$l ISO-8859-7"
+ echo "$l.iso-8859-7 ISO-8859-7"
+ echo "$l.cp-869 CP869"
+ echo "$l.cp-1253 CP1253"
+ echo "$l.cp-1253@euro CP1253"
+ echo "$l.utf-8 UTF-8"
+ echo "$l.utf-8@euro UTF-8"
+ done
+ for l in he he_IL iw iw_IL; do
+ echo "$l ISO-8859-8"
+ echo "$l.iso-8859-8 ISO-8859-8"
+ echo "$l.cp-862 CP862"
+ echo "$l.cp-1255 CP1255"
+ echo "$l.utf-8 UTF-8"
+ done
+ for l in tr tr_TR; do
+ echo "$l ISO-8859-9"
+ echo "$l.iso-8859-9 ISO-8859-9"
+ echo "$l.cp-857 CP857"
+ echo "$l.cp-1254 CP1254"
+ echo "$l.utf-8 UTF-8"
+ done
+ for l in lt lt_LT lv lv_LV; do
+ #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
+ echo "$l ISO-8859-13"
+ done
+ for l in ru_UA uk uk_UA; do
+ echo "$l KOI8-U"
+ done
+ for l in zh zh_CN; do
+ #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
+ echo "$l GB2312"
+ done
+ for l in ja ja_JP ja_JP.EUC; do
+ echo "$l EUC-JP"
+ done
+ for l in ko ko_KR; do
+ echo "$l EUC-KR"
+ done
+ for l in th th_TH; do
+ echo "$l TIS-620"
+ done
+ for l in fa fa_IR; do
+ #echo "$l ISIRI-3342" # a broken encoding
+ echo "$l.utf-8 UTF-8"
+ done
+ ;;
+ linux* | *-gnu*)
+ # With glibc-2.1 or newer, we don't need any canonicalization,
+ # because glibc has iconv and both glibc and libiconv support all
+ # GNU canonical names directly. Therefore, the Makefile does not
+ # need to install the alias file at all.
+ # The following applies only to glibc-2.0.x and older libcs.
+ echo "ISO_646.IRV:1983 ASCII"
+ ;;
+ aix*)
+ echo "ISO8859-1 ISO-8859-1"
+ echo "ISO8859-2 ISO-8859-2"
+ echo "ISO8859-5 ISO-8859-5"
+ echo "ISO8859-6 ISO-8859-6"
+ echo "ISO8859-7 ISO-8859-7"
+ echo "ISO8859-8 ISO-8859-8"
+ echo "ISO8859-9 ISO-8859-9"
+ echo "ISO8859-15 ISO-8859-15"
+ echo "IBM-850 CP850"
+ echo "IBM-856 CP856"
+ echo "IBM-921 ISO-8859-13"
+ echo "IBM-922 CP922"
+ echo "IBM-932 CP932"
+ echo "IBM-943 CP943"
+ echo "IBM-1046 CP1046"
+ echo "IBM-1124 CP1124"
+ echo "IBM-1129 CP1129"
+ echo "IBM-1252 CP1252"
+ echo "IBM-eucCN GB2312"
+ echo "IBM-eucJP EUC-JP"
+ echo "IBM-eucKR EUC-KR"
+ echo "IBM-eucTW EUC-TW"
+ echo "big5 BIG5"
+ echo "GBK GBK"
+ echo "TIS-620 TIS-620"
+ echo "UTF-8 UTF-8"
+ ;;
+ hpux*)
+ echo "iso88591 ISO-8859-1"
+ echo "iso88592 ISO-8859-2"
+ echo "iso88595 ISO-8859-5"
+ echo "iso88596 ISO-8859-6"
+ echo "iso88597 ISO-8859-7"
+ echo "iso88598 ISO-8859-8"
+ echo "iso88599 ISO-8859-9"
+ echo "iso885915 ISO-8859-15"
+ echo "roman8 HP-ROMAN8"
+ echo "arabic8 HP-ARABIC8"
+ echo "greek8 HP-GREEK8"
+ echo "hebrew8 HP-HEBREW8"
+ echo "turkish8 HP-TURKISH8"
+ echo "kana8 HP-KANA8"
+ echo "tis620 TIS-620"
+ echo "big5 BIG5"
+ echo "eucJP EUC-JP"
+ echo "eucKR EUC-KR"
+ echo "eucTW EUC-TW"
+ echo "hp15CN GB2312"
+ #echo "ccdc ?" # what is this?
+ echo "SJIS SHIFT_JIS"
+ echo "utf8 UTF-8"
+ ;;
+ irix*)
+ echo "ISO8859-1 ISO-8859-1"
+ echo "ISO8859-2 ISO-8859-2"
+ echo "ISO8859-5 ISO-8859-5"
+ echo "ISO8859-7 ISO-8859-7"
+ echo "ISO8859-9 ISO-8859-9"
+ echo "eucCN GB2312"
+ echo "eucJP EUC-JP"
+ echo "eucKR EUC-KR"
+ echo "eucTW EUC-TW"
+ ;;
+ osf*)
+ 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-7 ISO-8859-7"
+ echo "ISO8859-8 ISO-8859-8"
+ echo "ISO8859-9 ISO-8859-9"
+ echo "ISO8859-15 ISO-8859-15"
+ echo "cp850 CP850"
+ echo "big5 BIG5"
+ echo "dechanyu DEC-HANYU"
+ echo "dechanzi GB2312"
+ echo "deckanji DEC-KANJI"
+ echo "deckorean EUC-KR"
+ echo "eucJP EUC-JP"
+ echo "eucKR EUC-KR"
+ echo "eucTW EUC-TW"
+ echo "GBK GBK"
+ echo "KSC5601 CP949"
+ echo "sdeckanji EUC-JP"
+ echo "SJIS SHIFT_JIS"
+ echo "TACTIS TIS-620"
+ echo "UTF-8 UTF-8"
+ ;;
+ solaris*)
+ 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"
+ echo "ISO8859-7 ISO-8859-7"
+ echo "ISO8859-8 ISO-8859-8"
+ echo "ISO8859-9 ISO-8859-9"
+ echo "ISO8859-15 ISO-8859-15"
+ echo "koi8-r KOI8-R"
+ echo "ansi-1251 CP1251"
+ 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"
+ #echo "sun_eu_greek ?" # what is this?
+ echo "UTF-8 UTF-8"
+ ;;
+ freebsd* | os2*)
+ # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
+ # localcharset.c falls back to using the full locale name
+ # from the environment variables.
+ # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
+ # reuse FreeBSD's locale data for OS/2.
+ echo "C ASCII"
+ echo "US-ASCII ASCII"
+ for l in la_LN lt_LN; do
+ echo "$l.ASCII ASCII"
+ done
+ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
+ lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
+ echo "$l.ISO_8859-1 ISO-8859-1"
+ echo "$l.DIS_8859-15 ISO-8859-15"
+ done
+ for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
+ echo "$l.ISO_8859-2 ISO-8859-2"
+ done
+ for l in la_LN lt_LT; do
+ echo "$l.ISO_8859-4 ISO-8859-4"
+ done
+ for l in ru_RU ru_SU; do
+ echo "$l.KOI8-R KOI8-R"
+ echo "$l.ISO_8859-5 ISO-8859-5"
+ echo "$l.CP866 CP866"
+ done
+ echo "uk_UA.KOI8-U KOI8-U"
+ echo "zh_TW.BIG5 BIG5"
+ echo "zh_TW.Big5 BIG5"
+ echo "zh_CN.EUC GB2312"
+ echo "ja_JP.EUC EUC-JP"
+ echo "ja_JP.SJIS SHIFT_JIS"
+ 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"
+ ;;
+ darwin[56]*)
+ # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
+ # localcharset.c falls back to using the full locale name
+ # from the environment variables.
+ echo "C ASCII"
+ for l in en_AU en_CA en_GB en_US la_LN; do
+ echo "$l.US-ASCII ASCII"
+ done
+ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
+ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
+ nl_NL no_NO pt_PT sv_SE; do
+ echo "$l ISO-8859-1"
+ echo "$l.ISO8859-1 ISO-8859-1"
+ echo "$l.ISO8859-15 ISO-8859-15"
+ done
+ for l in la_LN; do
+ echo "$l.ISO8859-1 ISO-8859-1"
+ echo "$l.ISO8859-15 ISO-8859-15"
+ done
+ for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
+ echo "$l.ISO8859-2 ISO-8859-2"
+ done
+ for l in la_LN lt_LT; do
+ echo "$l.ISO8859-4 ISO-8859-4"
+ done
+ for l in ru_RU; do
+ echo "$l.KOI8-R KOI8-R"
+ echo "$l.ISO8859-5 ISO-8859-5"
+ echo "$l.CP866 CP866"
+ done
+ for l in bg_BG; do
+ echo "$l.CP1251 CP1251"
+ done
+ echo "uk_UA.KOI8-U KOI8-U"
+ echo "zh_TW.BIG5 BIG5"
+ echo "zh_TW.Big5 BIG5"
+ echo "zh_CN.EUC GB2312"
+ echo "ja_JP.EUC EUC-JP"
+ echo "ja_JP.SJIS SHIFT_JIS"
+ echo "ko_KR.EUC EUC-KR"
+ ;;
+ darwin*)
+ # Darwin 7.5 has nl_langinfo(CODESET), but it is useless:
+ # - It returns the empty string when LANG is set to a locale of the
+ # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8
+ # LC_CTYPE file.
+ # - The environment variables LANG, LC_CTYPE, LC_ALL are not set by
+ # the system; nl_langinfo(CODESET) returns "US-ASCII" in this case.
+ # - The documentation says:
+ # "... all code that calls BSD system routines should ensure
+ # that the const *char parameters of these routines are in UTF-8
+ # encoding. All BSD system functions expect their string
+ # parameters to be in UTF-8 encoding and nothing else."
+ # It also says
+ # "An additional caveat is that string parameters for files,
+ # paths, and other file-system entities must be in canonical
+ # UTF-8. In a canonical UTF-8 Unicode string, all decomposable
+ # characters are decomposed ..."
+ # but this is not true: You can pass non-decomposed UTF-8 strings
+ # to file system functions, and it is the OS which will convert
+ # them to decomposed UTF-8 before accessing the file system.
+ # - The Apple Terminal application displays UTF-8 by default.
+ # - However, other applications are free to use different encodings:
+ # - xterm uses ISO-8859-1 by default.
+ # - TextEdit uses MacRoman by default.
+ # We prefer UTF-8 over decomposed UTF-8-MAC because one should
+ # minimize the use of decomposed Unicode. Unfortunately, through the
+ # Darwin file system, decomposed UTF-8 strings are leaked into user
+ # space nevertheless.
+ echo "* UTF-8"
+ ;;
+ beos*)
+ # BeOS has a single locale, and it has UTF-8 encoding.
+ echo "* UTF-8"
+ ;;
+ msdosdjgpp*)
+ # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
+ # localcharset.c falls back to using the full locale name
+ # from the environment variables.
+ echo "#"
+ echo "# The encodings given here may not all be correct."
+ echo "# If you find that the encoding given for your language and"
+ 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 <bruno@clisp.org>."
+ echo "#"
+ echo "C ASCII"
+ # ISO-8859-1 languages
+ echo "ca CP850"
+ echo "ca_ES CP850"
+ echo "da CP865" # not CP850 ??
+ echo "da_DK CP865" # not CP850 ??
+ echo "de CP850"
+ echo "de_AT CP850"
+ echo "de_CH CP850"
+ echo "de_DE CP850"
+ echo "en CP850"
+ echo "en_AU CP850" # not CP437 ??
+ echo "en_CA CP850"
+ echo "en_GB CP850"
+ echo "en_NZ CP437"
+ echo "en_US CP437"
+ echo "en_ZA CP850" # not CP437 ??
+ echo "es CP850"
+ echo "es_AR CP850"
+ echo "es_BO CP850"
+ echo "es_CL CP850"
+ echo "es_CO CP850"
+ echo "es_CR CP850"
+ echo "es_CU CP850"
+ echo "es_DO CP850"
+ echo "es_EC CP850"
+ echo "es_ES CP850"
+ echo "es_GT CP850"
+ echo "es_HN CP850"
+ echo "es_MX CP850"
+ echo "es_NI CP850"
+ echo "es_PA CP850"
+ echo "es_PY CP850"
+ echo "es_PE CP850"
+ echo "es_SV CP850"
+ echo "es_UY CP850"
+ echo "es_VE CP850"
+ echo "et CP850"
+ echo "et_EE CP850"
+ echo "eu CP850"
+ echo "eu_ES CP850"
+ echo "fi CP850"
+ echo "fi_FI CP850"
+ echo "fr CP850"
+ echo "fr_BE CP850"
+ echo "fr_CA CP850"
+ echo "fr_CH CP850"
+ echo "fr_FR CP850"
+ echo "ga CP850"
+ echo "ga_IE CP850"
+ echo "gd CP850"
+ echo "gd_GB CP850"
+ echo "gl CP850"
+ echo "gl_ES CP850"
+ echo "id CP850" # not CP437 ??
+ echo "id_ID CP850" # not CP437 ??
+ echo "is CP861" # not CP850 ??
+ echo "is_IS CP861" # not CP850 ??
+ echo "it CP850"
+ echo "it_CH CP850"
+ echo "it_IT CP850"
+ echo "lt CP775"
+ echo "lt_LT CP775"
+ echo "lv CP775"
+ echo "lv_LV CP775"
+ echo "nb CP865" # not CP850 ??
+ echo "nb_NO CP865" # not CP850 ??
+ echo "nl CP850"
+ echo "nl_BE CP850"
+ echo "nl_NL CP850"
+ echo "nn CP865" # not CP850 ??
+ echo "nn_NO CP865" # not CP850 ??
+ echo "no CP865" # not CP850 ??
+ echo "no_NO CP865" # not CP850 ??
+ echo "pt CP850"
+ echo "pt_BR CP850"
+ echo "pt_PT CP850"
+ echo "sv CP850"
+ echo "sv_SE CP850"
+ # ISO-8859-2 languages
+ echo "cs CP852"
+ echo "cs_CZ CP852"
+ echo "hr CP852"
+ echo "hr_HR CP852"
+ echo "hu CP852"
+ echo "hu_HU CP852"
+ echo "pl CP852"
+ echo "pl_PL CP852"
+ echo "ro CP852"
+ echo "ro_RO CP852"
+ echo "sk CP852"
+ echo "sk_SK CP852"
+ echo "sl CP852"
+ echo "sl_SI CP852"
+ echo "sq CP852"
+ echo "sq_AL CP852"
+ echo "sr CP852" # CP852 or CP866 or CP855 ??
+ echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
+ echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
+ # ISO-8859-3 languages
+ echo "mt CP850"
+ echo "mt_MT CP850"
+ # ISO-8859-5 languages
+ echo "be CP866"
+ echo "be_BE CP866"
+ echo "bg CP866" # not CP855 ??
+ echo "bg_BG CP866" # not CP855 ??
+ echo "mk CP866" # not CP855 ??
+ echo "mk_MK CP866" # not CP855 ??
+ 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"
+ echo "ar_DZ CP864"
+ echo "ar_EG CP864"
+ echo "ar_IQ CP864"
+ echo "ar_IR CP864"
+ echo "ar_JO CP864"
+ echo "ar_KW CP864"
+ echo "ar_MA CP864"
+ echo "ar_OM CP864"
+ echo "ar_QA CP864"
+ echo "ar_SA CP864"
+ echo "ar_SY CP864"
+ # ISO-8859-7 languages
+ echo "el CP869"
+ echo "el_GR CP869"
+ # ISO-8859-8 languages
+ echo "he CP862"
+ echo "he_IL CP862"
+ # ISO-8859-9 languages
+ echo "tr CP857"
+ echo "tr_TR CP857"
+ # Japanese
+ echo "ja CP932"
+ echo "ja_JP CP932"
+ # Chinese
+ echo "zh_CN GBK"
+ echo "zh_TW CP950" # not CP938 ??
+ # Korean
+ echo "kr CP949" # not CP934 ??
+ echo "kr_KR CP949" # not CP934 ??
+ # Thai
+ echo "th CP874"
+ echo "th_TH CP874"
+ # Other
+ echo "eo CP850"
+ echo "eo_EO CP850"
+ ;;
+esac
diff --git a/src/libs/libgroff/localcharset.c b/src/libs/libgroff/localcharset.c
new file mode 100644
index 00000000..51af9282
--- /dev/null
+++ b/src/libs/libgroff/localcharset.c
@@ -0,0 +1,416 @@
+/* Determine a canonical name for the current locale's character encoding.
+
+ Copyright (C) 2000-2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+/* Written by Bruno Haible <bruno@clisp.org>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification. */
+#include "localcharset.h"
+
+#if HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#include <stdio.h>
+#if HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if defined _WIN32 || defined __WIN32__
+# undef WIN32 /* avoid warning on mingw32 */
+# define WIN32
+#endif
+
+#if defined __EMX__
+/* Assume EMX program runs on OS/2, even if compiled under DOS. */
+# define OS2
+#endif
+
+#if !defined WIN32
+# if HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+# else
+# if HAVE_SETLOCALE
+# include <locale.h>
+# endif
+# endif
+#elif defined WIN32
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+#if defined OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+/* BEGIN GROFF-LOCAL SECTION */
+#include "relocate.h"
+#define relocate(path) relocatep(path)
+/* END GROFF-LOCAL SECTION */
+
+#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
+ /* Win32, Cygwin, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#endif
+
+#ifndef DIRECTORY_SEPARATOR
+# define DIRECTORY_SEPARATOR '/'
+#endif
+
+#ifndef ISSLASH
+# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
+#endif
+
+#if HAVE_DECL_GETC_UNLOCKED
+# undef getc
+# define getc getc_unlocked
+#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
+ 'charset_aliases' simultaneously, both will produce the same value,
+ and everything will be ok if the two assignments to 'charset_aliases'
+ are atomic. But I don't know what will happen if the two assignments mix. */
+#if __STDC__ != 1
+# define volatile /* empty */
+#endif
+/* Pointer to the contents of the charset.alias file, if it has already been
+ read, else NULL. Its format is:
+ ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
+static const char * volatile charset_aliases;
+
+/* Return a pointer to the contents of the charset.alias file. */
+static const char *
+get_charset_aliases ()
+{
+ const char *cp;
+
+ cp = charset_aliases;
+ if (cp == NULL)
+ {
+#if !(defined VMS || defined WIN32)
+ FILE *fp;
+ const char *dir;
+ const char *base = "charset.alias";
+ char *file_name;
+
+ /* Make it possible to override the charset.alias location. This is
+ necessary for running the testsuite before "make install". */
+ dir = getenv ("CHARSETALIASDIR");
+ if (dir == NULL || dir[0] == '\0')
+ dir = relocate (LIBDIR);
+
+ /* Concatenate dir and base into freshly allocated file_name. */
+ {
+ size_t dir_len = strlen (dir);
+ size_t base_len = strlen (base);
+ int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
+ file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
+ if (file_name != NULL)
+ {
+ memcpy (file_name, dir, dir_len);
+ if (add_slash)
+ file_name[dir_len] = DIRECTORY_SEPARATOR;
+ memcpy (file_name + dir_len + add_slash, base, base_len + 1);
+ }
+ }
+
+ if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
+ /* Out of memory or file not found, treat it as empty. */
+ cp = "";
+ else
+ {
+ /* Parse the file's contents. */
+ char *res_ptr = NULL;
+ size_t res_size = 0;
+
+ for (;;)
+ {
+ int c;
+ char buf1[50+1];
+ char buf2[50+1];
+ size_t l1, l2;
+ char *old_res_ptr;
+
+ c = getc (fp);
+ if (c == EOF)
+ break;
+ if (c == '\n' || c == ' ' || c == '\t')
+ continue;
+ if (c == '#')
+ {
+ /* Skip comment, to end of line. */
+ do
+ c = getc (fp);
+ while (!(c == EOF || c == '\n'));
+ if (c == EOF)
+ break;
+ continue;
+ }
+ ungetc (c, fp);
+ if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
+ break;
+ l1 = strlen (buf1);
+ l2 = strlen (buf2);
+ old_res_ptr = res_ptr;
+ if (res_size == 0)
+ {
+ res_size = l1 + 1 + l2 + 1;
+ res_ptr = (char *) malloc (res_size + 1);
+ }
+ else
+ {
+ res_size += l1 + 1 + l2 + 1;
+ res_ptr = (char *) realloc (res_ptr, res_size + 1);
+ }
+ if (res_ptr == NULL)
+ {
+ /* Out of memory. */
+ res_size = 0;
+ if (old_res_ptr != NULL)
+ free (old_res_ptr);
+ break;
+ }
+ strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
+ strcpy (res_ptr + res_size - (l2 + 1), buf2);
+ }
+ fclose (fp);
+ if (res_size == 0)
+ cp = "";
+ else
+ {
+ *(res_ptr + res_size) = '\0';
+ cp = res_ptr;
+ }
+ }
+
+ if (file_name != NULL)
+ free (file_name);
+
+#else
+
+# if defined VMS
+ /* To avoid the troubles of an extra file charset.alias_vms in the
+ sources of many GNU packages, simply inline the aliases here. */
+ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
+ "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
+ section 10.7 "Handling Different Character Sets". */
+ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
+ "ISO8859-2" "\0" "ISO-8859-2" "\0"
+ "ISO8859-5" "\0" "ISO-8859-5" "\0"
+ "ISO8859-7" "\0" "ISO-8859-7" "\0"
+ "ISO8859-8" "\0" "ISO-8859-8" "\0"
+ "ISO8859-9" "\0" "ISO-8859-9" "\0"
+ /* Japanese */
+ "eucJP" "\0" "EUC-JP" "\0"
+ "SJIS" "\0" "SHIFT_JIS" "\0"
+ "DECKANJI" "\0" "DEC-KANJI" "\0"
+ "SDECKANJI" "\0" "EUC-JP" "\0"
+ /* Chinese */
+ "eucTW" "\0" "EUC-TW" "\0"
+ "DECHANYU" "\0" "DEC-HANYU" "\0"
+ "DECHANZI" "\0" "GB2312" "\0"
+ /* Korean */
+ "DECKOREAN" "\0" "EUC-KR" "\0";
+# endif
+
+# if defined WIN32
+ /* To avoid the troubles of installing a separate file in the same
+ directory as the DLL and of retrieving the DLL's directory at
+ runtime, simply inline the aliases here. */
+
+ cp = "CP936" "\0" "GBK" "\0"
+ "CP1361" "\0" "JOHAB" "\0"
+ "CP20127" "\0" "ASCII" "\0"
+ "CP20866" "\0" "KOI8-R" "\0"
+ "CP20936" "\0" "GB2312" "\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"
+ "CP38598" "\0" "ISO-8859-8" "\0"
+ "CP51932" "\0" "EUC-JP" "\0"
+ "CP51936" "\0" "GB2312" "\0"
+ "CP51949" "\0" "EUC-KR" "\0"
+ "CP51950" "\0" "EUC-TW" "\0"
+ "CP54936" "\0" "GB18030" "\0"
+ "CP65001" "\0" "UTF-8" "\0";
+# endif
+#endif
+
+ charset_aliases = cp;
+ }
+
+ return cp;
+}
+
+/* Determine the current locale's character encoding, and canonicalize it
+ into one of the canonical names listed in config.charset.
+ The result must not be freed; it is statically allocated.
+ If the canonical name cannot be determined, the result is a non-canonical
+ name. */
+
+#ifdef STATIC
+STATIC
+#endif
+const char *
+locale_charset ()
+{
+ const char *codeset;
+ const char *aliases;
+
+#if !(defined WIN32 || defined OS2)
+
+# if HAVE_LANGINFO_CODESET
+
+ /* Most systems support nl_langinfo (CODESET) nowadays. */
+ codeset = nl_langinfo (CODESET);
+
+# else
+
+ /* On old systems which lack it, use setlocale or getenv. */
+ const char *locale = NULL;
+
+ /* But most old systems don't have a complete set of locales. Some
+ (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
+ use setlocale here; it would return "C" when it doesn't support the
+ locale name the user has set. */
+# if HAVE_SETLOCALE && 0
+ locale = setlocale (LC_CTYPE, NULL);
+# endif
+ if (locale == NULL || locale[0] == '\0')
+ {
+ locale = getenv ("LC_ALL");
+ if (locale == NULL || locale[0] == '\0')
+ {
+ locale = getenv ("LC_CTYPE");
+ if (locale == NULL || locale[0] == '\0')
+ locale = getenv ("LANG");
+ }
+ }
+
+ /* On some old systems, one used to set locale = "iso8859_1". On others,
+ you set it to "language_COUNTRY.charset". In any case, we resolve it
+ through the charset.alias file. */
+ codeset = locale;
+
+# endif
+
+#elif defined WIN32
+
+ static char buf[2 + 10 + 1];
+
+ /* Woe32 has a function returning the locale's codepage as a number. */
+ sprintf (buf, "CP%u", GetACP ());
+ codeset = buf;
+
+#elif defined OS2
+
+ const char *locale;
+ static char buf[2 + 10 + 1];
+ ULONG cp[3];
+ ULONG cplen;
+
+ /* Allow user to override the codeset, as set in the operating system,
+ with standard language environment variables. */
+ locale = getenv ("LC_ALL");
+ if (locale == NULL || locale[0] == '\0')
+ {
+ locale = getenv ("LC_CTYPE");
+ if (locale == NULL || locale[0] == '\0')
+ locale = getenv ("LANG");
+ }
+ if (locale != NULL && locale[0] != '\0')
+ {
+ /* If the locale name contains an encoding after the dot, return it. */
+ const char *dot = strchr (locale, '.');
+
+ if (dot != NULL)
+ {
+ const char *modifier;
+
+ dot++;
+ /* Look for the possible @... trailer and remove it, if any. */
+ modifier = strchr (dot, '@');
+ if (modifier == NULL)
+ return dot;
+ if (modifier - dot < sizeof (buf))
+ {
+ memcpy (buf, dot, modifier - dot);
+ buf [modifier - dot] = '\0';
+ return buf;
+ }
+ }
+
+ /* Resolve through the charset.alias file. */
+ codeset = locale;
+ }
+ else
+ {
+ /* OS/2 has a function returning the locale's codepage as a number. */
+ if (DosQueryCp (sizeof (cp), cp, &cplen))
+ codeset = "";
+ else
+ {
+ sprintf (buf, "CP%u", cp[0]);
+ codeset = buf;
+ }
+ }
+
+#endif
+
+ if (codeset == NULL)
+ /* The canonical name cannot be determined. */
+ codeset = "";
+
+ /* Resolve alias. */
+ for (aliases = get_charset_aliases ();
+ *aliases != '\0';
+ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
+ if (strcmp (codeset, aliases) == 0
+ || (aliases[0] == '*' && aliases[1] == '\0'))
+ {
+ codeset = aliases + strlen (aliases) + 1;
+ 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/src/libs/libgroff/ref-add.sin b/src/libs/libgroff/ref-add.sin
new file mode 100644
index 00000000..0e2b97b0
--- /dev/null
+++ b/src/libs/libgroff/ref-add.sin
@@ -0,0 +1,31 @@
+# Add this package to a list of references stored in a text file.
+#
+# Copyright (C) 2000 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+#
+# Written by Bruno Haible <bruno@clisp.org>.
+#
+/^# Packages using this file: / {
+ s/# Packages using this file://
+ ta
+ :a
+ s/ @PACKAGE@ / @PACKAGE@ /
+ tb
+ s/ $/ @PACKAGE@ /
+ :b
+ s/^/# Packages using this file:/
+}
diff --git a/src/libs/libgroff/ref-del.sin b/src/libs/libgroff/ref-del.sin
new file mode 100644
index 00000000..1fafbfc0
--- /dev/null
+++ b/src/libs/libgroff/ref-del.sin
@@ -0,0 +1,26 @@
+# Remove this package from a list of references stored in a text file.
+#
+# Copyright (C) 2000 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+#
+# Written by Bruno Haible <bruno@clisp.org>.
+#
+/^# Packages using this file: / {
+ s/# Packages using this file://
+ s/ @PACKAGE@ / /
+ s/^/# Packages using this file:/
+}
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 105837b2..190e6e91 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -26,15 +26,12 @@ Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
#include <errno.h>
#include "errarg.h"
#include "error.h"
+#include "localcharset.h"
#include "nonposix.h"
#include "stringclass.h"
#include <locale.h>
-#if HAVE_LANGINFO_CODESET
-# include <langinfo.h>
-#endif
-
#if HAVE_ICONV
# include <iconv.h>
# ifdef WORDS_BIGENDIAN
@@ -1104,18 +1101,11 @@ main(int argc, char **argv)
// getopt() is called since the usage message shows the default
// encoding.
setlocale(LC_ALL, "");
-#if HAVE_LANGINFO_CODESET
char *locale = setlocale(LC_CTYPE, NULL);
if (!locale || !strcmp(locale, "C") || !strcmp(locale, "POSIX"))
default_encoding = "latin1";
- else {
- default_encoding = nl_langinfo(CODESET);
- if (!default_encoding)
- default_encoding = "latin1";
- }
-#else
- default_encoding = "latin1";
-#endif /* HAVE_LANGINFO_CODESET */
+ else
+ default_encoding = locale_charset();
program_name = argv[0];
int opt;