Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: alternative wcwidth() implementation



On Tue, 22 Apr 2008 17:15:43 +0100
Peter Stephenson <pws@xxxxxxx> wrote:
> 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.

On Solaris 8 this isn't good enough: we need the _EXTENDED version or we
don't get the full interface from sys/time.h.  That's already in use in
some cases, maybe this isn't too big a deal...

Index: Src/system.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/system.h,v
retrieving revision 1.50
diff -u -r1.50 system.h
--- Src/system.h	22 Apr 2008 16:18:55 -0000	1.50
+++ Src/system.h	23 Apr 2008 10:30:05 -0000
@@ -56,8 +56,13 @@
 # define _XOPEN_SOURCE_EXTENDED 1
 #else
 # ifdef MULTIBYTE_SUPPORT
-/* Needed for wcwidth() which is part of XSI */
-#  define _XOPEN_SOURCE 1
+/*
+ * Needed for wcwidth() which is part of XSI.
+ * Various other uses of the interface mean we can't get away with just
+ * _XOPEN_SOURCE.
+ */
+/*#  define _XOPEN_SOURCE 1*/
+#  define _XOPEN_SOURCE_EXTENDED 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