On 13 May 2005 03:11:36 -0700, Gisle Aas <[EMAIL PROTECTED]> wrote: > Another way to fix this to to make $? be exactly those 16 bits > described by this code segment found in description of system in > perlfunc: > > | You can check all the failure possibilities by inspecting > | C<$?> like this: > | > | 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; > | }
this code identifies the low seven bits as the signal, the eigth bit as the coredump flag, and divides by 256 to get the exit value. It does not assert in any way that the exit value is limited to eight bits. Based on this example alone, I would expect the possiblities for valid exit value to max out at, if not INT_MAX>>8, at least SHRT_MAX>>8, which IIRC on a Dec Alpha would have been 0x7fffff. Does AIX 5 have 32-bit shorts?