changeset 7058:35f0e7415e65

Assume an ASCII compatible wide character encoding.
author Bruno Haible <bruno@clisp.org>
date Fri, 28 Jul 2006 15:31:45 +0000
parents cb4ff5d170d3
children 0fca2a1a6835
files lib/mbswidth.c lib/wcwidth.h
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -51,7 +51,7 @@
 # include <wctype.h>
 #endif
 #if !defined iswcntrl && !HAVE_ISWCNTRL
-# define iswcntrl(wc) 0
+# define iswcntrl(wc) (((wc) & ~0x1f) == 0 || (wc) == 0x7f)
 #endif
 
 #ifndef mbsinit
--- a/lib/wcwidth.h
+++ b/lib/wcwidth.h
@@ -36,7 +36,13 @@
 #  include <wctype.h>
 # endif
 # if !defined iswprint && !HAVE_ISWPRINT
-#  define iswprint(wc) 1
+ststic inline int
+iswprint (wint_t wc)
+{
+  return (wc >= 0 && wc < 128
+	  ? wc >= ' ' && wc <= '~'
+	  : 1);
+}
 # endif
 
 # ifndef HAVE_DECL_WCWIDTH