diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | builtin.c | 4 | ||||
-rw-r--r-- | pc/ChangeLog | 14 | ||||
-rw-r--r-- | pc/Makefile | 6 | ||||
-rw-r--r-- | pc/gawkmisc.pc | 22 | ||||
-rw-r--r-- | pc/popen.h | 4 |
6 files changed, 52 insertions, 2 deletions
@@ -1,3 +1,7 @@ +2011-10-21 Eli Zaretskii <eliz@gnu.org> + + * builtin.c [HAVE_POPEN_H]: Include "popen.h". + 2011-10-21 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (distcleancheck_listfiles): Added, per advice from @@ -32,6 +32,10 @@ #include "random.h" #include "floatmagic.h" +#if defined(HAVE_POPEN_H) +#include "popen.h" +#endif + #ifndef CHAR_BIT # define CHAR_BIT 8 #endif diff --git a/pc/ChangeLog b/pc/ChangeLog index 08ed2bf6..3a7b3be3 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,17 @@ +2011-10-24 Eli Zaretskii <eliz@gnu.org> + + * gawkmisc.pc (wctob) [__MINGW32__]: A replacement for the + function of the same name in MS runtime, which does a better job + with 8-bit characters that have their high bit set. + Original supplied by Jim Meyering <jim@meyering.net>. + + * popen.h (system) [__MINGW32__]: Redirect to os_system. + + * Makefile (./doc/awkcard.tr): Don't use Unixy forward slashes in + redirection. + (builtin$O): Depend on popen.h. + (random$O): New target, separated from builtin$O. + 2011-10-18 Juan Manuel Guerrero <juan.guerrero@gmx.de> * Makefile: doc target to create all documentation files. diff --git a/pc/Makefile b/pc/Makefile index c6845c38..6156ce96 100644 --- a/pc/Makefile +++ b/pc/Makefile @@ -240,7 +240,9 @@ $(DRSPFILE) : $(DGAWKOBJS) $(ALLOBJS) $(LIBOBJS) eval_p$O profile_p$O: \ awk.h regex.h config.h gettext.h mbsupport.h protos.h dfa.h getopt.h -builtin$O random$O: floatmagic.h random.h +builtin$O: floatmagic.h random.h popen.h + +random$O: floatmagic.h random.h debug$O: floatmagic.h @@ -359,7 +361,7 @@ SEDME2 = sed "/%%Page: 10 10/,/0 Cg EP/d" ./doc/awkcard.tr: ./doc/awkcard.in cd doc - sed "s,SRCDIR,.," < ./awkcard.in > ./awkcard.tr + sed "s,SRCDIR,.," < awkcard.in > awkcard.tr cd .. ./doc/awkcard.nc: export GROFF_TMPDIR ?= . diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc index 43f81ff9..64b42396 100644 --- a/pc/gawkmisc.pc +++ b/pc/gawkmisc.pc @@ -547,6 +547,28 @@ usleep(unsigned int usec) return usec - msecf * 1000 < 0 ? 0 : (int)(usec - msecf * 1000); } +/* The implementation of wctob in the MS runtime is problematic + because it doesn't allow to distinguish between WEOF and 0xff, due + to integer sign extension. It also causes failures in dfa.c when + characters with the 8th bit set are involved. This replacement + version fixes that. */ + +#include <wchar.h> + +int +wctob (wint_t wc) +{ + char buf[64]; + + if (!(MB_CUR_MAX <= sizeof (buf))) + abort (); + /* Handle the case where WEOF is a value that does not fit in a wchar_t. */ + if (wc == (wchar_t)wc) + if (wctomb (buf, (wchar_t)wc) == 1) + return (unsigned char) buf[0]; + return EOF; +} + #endif /* __MINGW32__ */ #ifdef __DJGPP__ @@ -10,4 +10,8 @@ # define pclose(f) os_pclose(f) extern FILE *os_popen( const char *, const char * ); extern int os_pclose( FILE * ); +# ifdef __MINGW32__ +# define system(c) os_system(c) + extern int os_system( const char * ); +# endif /* __MINGW32__ */ #endif /* !__DJGPP__ */ |