From: Rafael Garcia-Suarez Date: Tue, 26 Aug 2003 20:34:48 +0000 (+0000) Subject: Integrate two DJGPP portability patches from the 5.6.2 branch : X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7da0e3835572d02b95a50131e2eb75d6ecad02e5;p=p5sagit%2Fp5-mst-13.2.git Integrate two DJGPP portability patches from the 5.6.2 branch : [20859] Two portability patches for DJGPP from Richard Dawe . Message-Id: [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..) --- diff --git a/djgpp/djgppsed.sh b/djgpp/djgppsed.sh index 8ce64a4..f84452e 100644 --- a/djgpp/djgppsed.sh +++ b/djgpp/djgppsed.sh @@ -39,7 +39,7 @@ sed -e $SABC t/io/inplace.t >s; mv -f s t/io/inplace.t sed -e $SDBMX -e $SDBHASH ext/GDBM_File/t/gdbm.t >s; mv -f s ext/GDBM_File/t/gdbm.t sed -e $SSTAT -e $STMP2 t/op/stat.t >s; mv -f s t/op/stat.t sed -e $SLIST x2p/Makefile.SH |tr -d '\r' >s; mv -f s x2p/Makefile.SH -sed -e 's=^#define.\([A-Z]\+\)_EXP.*$=#define \1_EXP djgpp_pathexp("\1")=g' config_h.SH >s; mv -f s config_h.SH +#sed -e 's=^#define.\([A-Z]\+\)_EXP.*$=#define \1_EXP djgpp_pathexp("\1")=g' config_h.SH >s; mv -f s config_h.SH sed -e 's=:^/:={^([a-z]:)?[\\\\/]}=g' lib/termcap.pl >s; mv -f s lib/termcap.pl sed -e $SPACKLIST installman >s; mv -f s installman sed -e $SPACKLIST lib/ExtUtils/Installed.pm >s; mv -f s lib/ExtUtils/Installed.pm diff --git a/dosish.h b/dosish.h index e606beb..1e4a58b 100644 --- a/dosish.h +++ b/dosish.h @@ -139,3 +139,48 @@ # define HAS_WAIT # define HAS_CHOWN #endif /* WIN32 */ + +/* + * : 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 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 + * to work with our return-code conversion. + */ + +#ifdef DJGPP + +#include + +#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 diff --git a/perl.c b/perl.c index 0569d5b..297e904 100644 --- a/perl.c +++ b/perl.c @@ -3759,7 +3759,7 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register for (; *env; env++) { if (!(s = strchr(*env,'='))) continue; -#if defined(MSDOS) +#if defined(MSDOS) && !defined(DJGPP) *s = '\0'; (void)strupr(*env); *s = '=';