Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: Pull up following revision(s) (requested by nakayama in tic...
details: https://anonhg.NetBSD.org/src/rev/76df8e66a589
branches: netbsd-8
changeset: 318169:76df8e66a589
user: martin <martin%NetBSD.org@localhost>
date: Sat Apr 14 10:50:49 2018 +0000
description:
Pull up following revision(s) (requested by nakayama in ticket #755):
external/bsd/mdocml/include/config.h: revision 1.5
external/bsd/mdocml/dist/term_ascii.c: revision 1.2
Re-enable wchar_t support. mandoc(1) can now fall back to ascii
output if the locale is non-UTF-8 locale with the following change.
https://marc.info/?l=openbsd-cvs&m=152364416720474
Modified files:
usr.bin/mandoc : term_ascii.c
Log message:
Make sure that mandoc only goes into UTF-8 mode if the user really
selected UTF-8, not some other multibyte locale. This obviously
makes no difference on OpenBSD but improves portability.
Issue reported by <Nakayama at NetBSD> via wiz@.
diffstat:
external/bsd/mdocml/dist/term_ascii.c | 14 +++++++++++++-
external/bsd/mdocml/include/config.h | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
diffs (48 lines):
diff -r 8cbda371322b -r 76df8e66a589 external/bsd/mdocml/dist/term_ascii.c
--- a/external/bsd/mdocml/dist/term_ascii.c Sat Apr 14 10:44:56 2018 +0000
+++ b/external/bsd/mdocml/dist/term_ascii.c Sat Apr 14 10:50:49 2018 +0000
@@ -21,11 +21,13 @@
#include <assert.h>
#if HAVE_WCHAR
+#include <langinfo.h>
#include <locale.h>
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#if HAVE_WCHAR
#include <wchar.h>
@@ -99,7 +101,17 @@
v = TERMENC_LOCALE == enc ?
setlocale(LC_CTYPE, "") :
setlocale(LC_CTYPE, UTF8_LOCALE);
- if (NULL != v && MB_CUR_MAX > 1) {
+
+ /*
+ * We only support UTF-8,
+ * so revert to ASCII for anything else.
+ */
+
+ if (v != NULL &&
+ strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
+ v = setlocale(LC_CTYPE, "C");
+
+ if (v != NULL && MB_CUR_MAX > 1) {
p->enc = enc;
p->advance = locale_advance;
p->endline = locale_endline;
diff -r 8cbda371322b -r 76df8e66a589 external/bsd/mdocml/include/config.h
--- a/external/bsd/mdocml/include/config.h Sat Apr 14 10:44:56 2018 +0000
+++ b/external/bsd/mdocml/include/config.h Sat Apr 14 10:50:49 2018 +0000
@@ -41,7 +41,7 @@
#define HAVE_STRTONUM 0
#define HAVE_SYS_ENDIAN 1
#define HAVE_VASPRINTF 1
-#define HAVE_WCHAR 0
+#define HAVE_WCHAR 1
#define HAVE_OHASH 0
#define BINM_APROPOS "apropos"
Home |
Main Index |
Thread Index |
Old Index