[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Gawk 4.0.0 Exec's Weirdly
From: |
Eli Zaretskii |
Subject: |
Re: [bug-gawk] Gawk 4.0.0 Exec's Weirdly |
Date: |
Fri, 21 Oct 2011 17:15:12 +0200 |
> Date: Fri, 30 Sep 2011 21:48:43 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
>
> > Date: Fri, 30 Sep 2011 17:55:01 +0300
> > From: Eli Zaretskii <address@hidden>
> > Cc: address@hidden
> >
> > The wrapper code is supposed to cause Gawk heed to the SHELL
> > environment variable. I'm inclined to change the wrapper so that if
> > SHELL is not defined in the environment, it does nothing and calls the
> > original `popen' from the C library with the original command. If no
> > one objects, I will do it when I have time.
>
> On second thought, perhaps instead of bypassing the wrapper, I should
> enable a similar wrapper around the call to `system', in which case
> both your "System" and "Loop" methods will no longer need extra
> quoting. WDYT?
Here's the patch to implement this:
Log message:
Make `system' and pipes work consistently on MS-Windows with quoted commands.
2011-10-21 Eli Zaretskii <address@hidden>
* builtin.c [HAVE_POPEN_H]: Include "popen.h".
--- builtin.c~ 2011-10-21 16:14:27.000000000 +0200
+++ builtin.c 2011-10-21 17:01:40.765250000 +0200
@@ -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
2011-10-21 Eli Zaretskii <address@hidden>
* 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.
--- pc/popen.h~ 2010-12-18 22:11:18.000000000 +0200
+++ pc/popen.h 2011-10-21 16:59:58.109000000 +0200
@@ -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__ */
--- pc/Makefile~ 2011-10-21 16:09:00.405875000 +0200
+++ pc/Makefile 2011-10-21 17:07:03.937125000 +0200
@@ -240,7 +240,9 @@
$(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