summaryrefslogtreecommitdiff
path: root/dosish.h
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-08-26 20:34:48 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-08-26 20:34:48 +0000
commit7da0e3835572d02b95a50131e2eb75d6ecad02e5 (patch)
treeb40c8c5a44b053ae222e0ec63e304cc82e5fabd7 /dosish.h
parentd34c2299ce15c4bc317af0031fa77cc4a77ec346 (diff)
downloadperl-7da0e3835572d02b95a50131e2eb75d6ecad02e5.tar.gz
Integrate two DJGPP portability patches from the 5.6.2 branch :
[20859] Two portability patches for DJGPP from Richard Dawe <rich@phekda.freeserve.co.uk>. Message-Id: <E19qfNh-0000Zq-00@phekda.freeserve.co.uk> [20911] Don't uppercase automatically all environment variables on DJGPP. (reported by Richard Dawe, this breaks portability of Unix scripts.) Don't change the behaviour on plain MS/DOS. p4raw-link: @20911 on //depot/maint-5.6/perl-5.6.2: 91a64263ab3d9ea51fa198428b79b128d13386a5 p4raw-link: @20859 on //depot/maint-5.6/perl-5.6.2: e61553d05d06f2b080893dabff3b9134ba8b77f7 p4raw-id: //depot/perl@20913 p4raw-edited: from //depot/maint-5.6/perl-5.6.2@20912 'edit in' perl.c (@20322..) p4raw-integrated: from //depot/maint-5.6/perl-5.6.2@20912 'merge in' djgpp/djgppsed.sh dosish.h (@20322..)
Diffstat (limited to 'dosish.h')
-rw-r--r--dosish.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/dosish.h b/dosish.h
index e606bebc66..1e4a58b968 100644
--- a/dosish.h
+++ b/dosish.h
@@ -139,3 +139,48 @@
# define HAS_WAIT
# define HAS_CHOWN
#endif /* WIN32 */
+
+/*
+ * <rich@phekda.freeserve.co.uk>: The DJGPP port has code that converts
+ * the return code of system() into the form that Unixy wait usually
+ * returns:
+ *
+ * - signal number in bits 0-6;
+ * - core dump flag in bit 7;
+ * - exit code in bits 8-15.
+ *
+ * Bits 0-7 are always zero for DJGPP, because it uses system().
+ * See djgpp.c.
+ *
+ * POSIX::W* use the W* macros from <sys/wait.h> to decode
+ * the return code. Unfortunately the W* macros for DJGPP use
+ * a different format than Unixy wait does. So there's a mismatch
+ * and, say, WEXITSTATUS($?) will return bogus values.
+ *
+ * So here we add hack to redefine the W* macros from DJGPP's <sys/wait.h>
+ * to work with our return-code conversion.
+ */
+
+#ifdef DJGPP
+
+#include <sys/wait.h>
+
+#undef WEXITSTATUS
+#undef WIFEXITED
+#undef WIFSIGNALED
+#undef WIFSTOPPED
+#undef WNOHANG
+#undef WSTOPSIG
+#undef WTERMSIG
+#undef WUNTRACED
+
+#define WEXITSTATUS(stat_val) ((stat_val) >> 8)
+#define WIFEXITED(stat_val) 0
+#define WIFSIGNALED(stat_val) 0
+#define WIFSTOPPED(stat_val) 0
+#define WNOHANG 0
+#define WSTOPSIG(stat_val) 0
+#define WTERMSIG(stat_val) 0
+#define WUNTRACED 0
+
+#endif