1*9a7741deSElliott Hughes# Unmodified nawk prints the 16 bit exit status divided by 256, but 2*9a7741deSElliott Hughes# does so using floating point arithmetic, yielding strange results. 3*9a7741deSElliott Hughes# 4*9a7741deSElliott Hughes# The fix is to use the various macros defined for wait(2) and to 5*9a7741deSElliott Hughes# use the signal number + 256 for death by signal, or signal number + 512 6*9a7741deSElliott Hughes# for death by signal with core dump. 7*9a7741deSElliott Hughes 8*9a7741deSElliott HughesBEGIN { 9*9a7741deSElliott Hughes status = system("exit 42") 10*9a7741deSElliott Hughes print "normal status", status 11*9a7741deSElliott Hughes 12*9a7741deSElliott Hughes status = system("kill -KILL $$") 13*9a7741deSElliott Hughes print "death by signal status", status 14*9a7741deSElliott Hughes 15*9a7741deSElliott Hughes status = system("kill -ABRT $$") 16*9a7741deSElliott Hughes print "death by signal with core dump status", status 17*9a7741deSElliott Hughes 18*9a7741deSElliott Hughes system("rm -f core*") 19*9a7741deSElliott Hughes} 20