Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: alternative wcwidth() implementation
- X-seq: zsh-workers 24862
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: alternative wcwidth() implementation
- Date: Tue, 22 Apr 2008 17:15:43 +0100
- In-reply-to: <31339.1208861418@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <31339.1208861418@xxxxxxx>
On Tue, 22 Apr 2008 11:50:18 +0100
Peter Stephenson <pws@xxxxxxx> wrote:
> I note we should supposedly be defining _XOPEN_SOURCE to get wcwidth(),
> at least with glibc, but apparently generally don't (though I did for the
> configure test). I'm a bit frightened of changing this, but POSIX does
> suggest it's part of the XSI extension, so probably we ought to.
> Indeed, we do define _XOPEN_SOURCE_EXTENDED if needed for curses.h;
> probably the right thing to do is in the #else case, #define
> _XOPEN_SOURCE if MULTIBYTE_SUPPORT is present.
Let's try it.
Index: Src/system.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/system.h,v
retrieving revision 1.49
diff -u -r1.49 system.h
--- Src/system.h 14 Dec 2007 15:14:06 -0000 1.49
+++ Src/system.h 22 Apr 2008 16:13:20 -0000
@@ -53,7 +53,12 @@
#endif
#if defined(ZSH_CURSES_SOURCE) && defined(ZSH_CURSES_NEEDS_XOPEN)
-#define _XOPEN_SOURCE_EXTENDED 1
+# define _XOPEN_SOURCE_EXTENDED 1
+#else
+# ifdef MULTIBYTE_SUPPORT
+/* Needed for wcwidth() which is part of XSI */
+# define _XOPEN_SOURCE 1
+# endif
#endif
/*
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author