summaryrefslogtreecommitdiff
path: root/lib/mbswidth.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-07-24 06:41:58 +0000
committerJim Meyering <jim@meyering.net>2000-07-24 06:41:58 +0000
commit66a0218c1a49815d29f28c1f50849a42095c3382 (patch)
tree0a68002acc5a4c6447217d52fa15d0f5baf24690 /lib/mbswidth.c
parent50c130325ef04457ecf76d3041b41baddc0302f7 (diff)
downloadcoreutils-66a0218c1a49815d29f28c1f50849a42095c3382.tar.xz
(_XOPEN_SOURCE): Don't define; this causes problems on Solaris 7.
(wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
Diffstat (limited to 'lib/mbswidth.c')
-rw-r--r--lib/mbswidth.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index 9a0d3a99b..09777c5b5 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -21,11 +21,6 @@
# include <config.h>
#endif
-/* Tell GNU libc to declare wcwidth(). */
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 500
-#endif
-
/* Get MB_LEN_MAX. */
#if HAVE_LIMITS_H
# include <limits.h>
@@ -62,10 +57,20 @@
# define mbsinit(ps) 1
#endif
-/* If wcwidth() doesn't exist, assume all printable characters have
+#ifndef HAVE_DECL_WCWIDTH
+"this configure-time declaration test was not run"
+#endif
+#if !HAVE_DECL_WCWIDTH
+int wcwidth ();
+#endif
+
+#ifndef wcwidth
+# if !HAVE_WCWIDTH
+/* wcwidth doesn't exist, so assume all printable characters have
width 1. */
-#if !defined wcwidth && !HAVE_WCWIDTH
-# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
+# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
+# else
+# endif
#endif
/* Get ISPRINT. */