$? width

$? width

Post by Emmanuel GUY » Tue, 08 Nov 1994 23:40:23



I'd like to know the width of $? (8 or 16 bits) because
I don't get the right value exemple 0xbea becomes 0xea with
Solaris 2.3 and ksh. Is this a bug or not ?

Thanks a lot

E.G.

 
 
 

$? width

Post by Dave Plon » Sun, 13 Nov 1994 07:31:07



> I'd like to know the width of $? (8 or 16 bits) because
> I don't get the right value exemple 0xbea becomes 0xea with
> Solaris 2.3 and ksh. Is this a bug or not ?

It's not... The POSIX WEXITSTATUS macro works this way (as described by
the HP-UX wait man page):

          WEXITSTATUS(stat_val)    If the value of WIFEXITED(stat_val) is
                                    non-zero, this macro evaluates to the
                                    low-order 8 bits of the argument that
                                    the process passed to exit() or _exit()
                                    (see exit(2)).

So, POSIX systems need only respect the low order 8 bits of the value
passed to exit. (The higher bits are used to determine, for instance,
how the process terminated, as with the WIFEXITED, WIFSIGNALED, and
WIFSTOPPED macros.)

Dave

--
------------------------------------------------------///--------------------
  Dave Plonka  ARS:N9HZF          Amiga - 68040 -    ///  486DLC-33 running

- Lead Systems Programmer, McHugh Freeman ------- \\X/- Waukesha, Wisconsin -