[ 21253]
Subject: [DOC PATCH] Re: [perl #23779] $? and negative exit codes
From: Dave Mitchell <davem@fdgroup.com>
Date: Tue, 16 Sep 2003 21:56:20 +0100
Message-ID: <
20030916205620.GB1246@fdgroup.com>
[ 21257]
Subject: [PATCH 5.8.1 @21211] magic.t
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Date: Tue, 16 Sep 2003 19:17:57 -0700
Message-ID: <
20030917021757.GA20261@math.berkeley.edu>
[ 21258]
Subject: [PATCH 5.8.1 @21211] os2_process.t
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Date: Tue, 16 Sep 2003 23:21:48 -0700
Message-ID: <
20030917062147.GA20400@math.berkeley.edu>
[ 21259]
Subject: [PATCH 5.8.1 @21211] OS/2 APIs again
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Date: Tue, 16 Sep 2003 23:49:42 -0700
Message-ID: <
20030917064941.GA20444@math.berkeley.edu>
[ 21260]
Fix Solaris ccversion not having the cc version.
[ 21261]
The AIX C product potentially consists of several packages,
the main package being (hopefully) the first one.
p4raw-link: @21261 on //depot/perl:
35727b84c71fa1997973466e1085cc7718896a75
p4raw-link: @21260 on //depot/perl:
68fed2afeea75342559d1bce2d459572bbdd23e4
p4raw-link: @21259 on //depot/perl:
4ab57fcbe55563102f75ccfb800b14bb33d79457
p4raw-link: @21258 on //depot/perl:
be4925cb01e0e3f28046e3417d8e84ca65859589
p4raw-link: @21257 on //depot/perl:
639cf43be4808c24d6c8660c3a09bcb92311abbf
p4raw-link: @21253 on //depot/perl:
4ef107a6cabd33854b770659cca90f12a2326104
p4raw-id: //depot/maint-5.8/perl@21262
p4raw-integrated: from //depot/perl@21251 'copy in'
os2/OS2/Process/t/os2_process.t (@18314..) hints/solaris_2.sh
(@19897..) hints/aix.sh (@21163..) 'merge in' os2/os2ish.h
(@20454..) t/op/magic.t (@20872..) pod/perlfunc.pod (@21198..)
gccversion=`$cc --version | sed 's/.*(GCC) *//'`
fi
;;
-*) ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -v '\.msg\.[A-Za-z_]*\.' | awk '{print $1,$2}'`
+*) ccversion=`lslpp -L | grep 'C for AIX Compiler$' | grep -v '\.msg\.[A-Za-z_]*\.' | head -1 | awk '{print $1,$2}'`
case "$ccversion" in
'') ccversion=`lslpp -L | grep 'IBM C and C++ Compilers LUM$'`
;;
#
# Using gcc.
#
- ccversion='gcc'
+ cc_name='gcc'
# See if as(1) is GNU as(1). GNU as(1) might not work for this job.
if echo "$verbose" | grep ' /usr/ccs/bin/as ' >/dev/null 2>&1; then
EOM
tryworkshopcc="${cc:-cc} try.c -o try"
if $tryworkshopcc >/dev/null 2>&1; then
- ccversion=`./try`
- if test "$ccversion" = "workshop" -a ! "$use64bitall_done"; then
- loclibpth="/usr/lib /usr/ccs/lib `$getworkshoplibs` $loclibpth"
+ cc_name=`./try`
+ if test "$cc_name" = "workshop"; then
+ ccversion="`${cc:-cc} -V 2>&1|sed -n -e '1s/^cc: //p'`"
+ if test ! "$use64bitall_done"; then
+ loclibpth="/usr/lib /usr/ccs/lib `$getworkshoplibs` $loclibpth"
+ fi
fi
fi
# after it has prompted the user for whether to use long doubles.
case "$uselongdouble" in
"$define"|true|[yY]*)
- if test "$ccversion" = "workshop"; then
+ if test "$cc_name" = "workshop"; then
cat > try.c << 'EOM'
#include <sunmath.h>
int main() { (void) powl(2, 256); return(0); }
}
use strict;
-use Test::More tests => 230;
+use Test::More tests => 232;
use OS2::Process;
sub SWP_flags ($) {
ok IsWindowShowing $k_hwnd, 'kid is showing';
ok IsWindowVisible $k_hwnd, 'kid is flaged as visible';
ok IsWindowEnabled $k_hwnd, 'kid is flaged as enabled';
+ SKIP: {
+ skip 'if defaultVIO=MAXIMIZED, new windows are shifted, but maximize to UL corner', 1 unless $fl & 0x800;
+ ok hWindowPos_set({x => $ppos[0], y => $ppos[1]}, $k_hwnd), 'x,y-restore for de-minimization of MAXIMIZED';
+ }
@nkpos = WindowPos $k_hwnd;
is_deeply([@ppos[0..5]], [@nkpos[0..5]], 'position restored');
+
# Now the other way
ok hWindowPos_set( {flags => 0x400}, $k_hwnd), 'set to minimized';
ok !IsWindowShowing $k_hwnd, 'kid is not showing';
ok IsWindowShowing $k_hwnd, 'kid is showing';
ok IsWindowVisible $k_hwnd, 'kid is flaged as visible';
ok IsWindowEnabled $k_hwnd, 'kid is flaged as enabled';
+ SKIP: {
+ skip 'if defaultVIO=MAXIMIZED, new windows are shifted, but maximize to UL corner', 1 unless $fl & 0x800;
+ ok hWindowPos_set({x => $ppos[0], y => $ppos[1]}, $k_hwnd), 'x,y-restore for de-minimization of MAXIMIZED';
+ }
@nkpos = WindowPos $k_hwnd;
is_deeply([@ppos[0..5]], [@nkpos[0..5]], 'position restored');
/* The expressions below return true on error. */
/* INCL_DOSERRORS needed. rc should be declared outside. */
-#define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
+#define CheckOSError(expr) ((rc = (expr)) ? (FillOSError(rc), rc) : 0)
/* INCL_WINERRORS needed. */
#define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
ORD_WinFlashWindow,
ORD_WinLoadPointer,
ORD_WinQuerySysPointer,
+ ORD_DosReplaceModule,
ORD_NENTRIES
};
#define DeclVoidFuncByORD(name,o,at,args) \
void name at { CallORD(void,o,at,args); }
-/* These functions return false on error, and save the error info in $^E */
+/* This function returns error code on error, and saves the error info in $^E and Perl_rc */
+#define DeclOSFuncByORD_native(ret,name,o,at,args) \
+ ret name at { unsigned long rc; return CheckOSError(CallORD(ret,o,at,args)); }
+
+/* These functions return false on error, and save the error info in $^E and Perl_rc */
#define DeclOSFuncByORD(ret,name,o,at,args) \
ret name at { unsigned long rc; return !CheckOSError(CallORD(ret,o,at,args)); }
#define DeclWinFuncByORD(ret,name,o,at,args) \
You can check all the failure possibilities by inspecting
C<$?> like this:
- $exit_value = $? >> 8;
- $signal_num = $? & 127;
- $dumped_core = $? & 128;
+ if ($? == -1) {
+ print "failed to execute: $!\n";
+ }
+ elsif ($? & 127) {
+ printf "child died with signal %d, %s coredump\n",
+ ($? & 127), ($? & 128) ? 'with' : 'without';
+ }
+ else {
+ printf "child exited with value %d\n", $? >> 8;
+ }
+
or more portably by using the W*() calls of the POSIX extension;
see L<perlport> for more information.
END
close CMDPIPE;
$? >>= 8 if $^O eq 'VMS'; # POSIX status hiding in 2nd byte
- print $? & 0xFF ? "ok 6\n" : "not ok 6\n";
+ my $todo = ($^O eq 'os2' ? ' # TODO: EMX v0.9d_fix4 bug: wrong nibble? ' : '');
+ print $? & 0xFF ? "ok 6$todo\n" : "not ok 6$todo\n";
$test += 4;
}