13ee4fc2aSCody Peter Mello# Unmodified nawk prints the 16 bit exit status divided by 256, but 23ee4fc2aSCody Peter Mello# does so using floating point arithmetic, yielding strange results. 33ee4fc2aSCody Peter Mello# 43ee4fc2aSCody Peter Mello# The fix is to use the various macros defined for wait(2) and to 53ee4fc2aSCody Peter Mello# use the signal number + 256 for death by signal, or signal number + 512 63ee4fc2aSCody Peter Mello# for death by signal with core dump. 73ee4fc2aSCody Peter Mello 83ee4fc2aSCody Peter MelloBEGIN { 93ee4fc2aSCody Peter Mello status = system("exit 42") 103ee4fc2aSCody Peter Mello print "normal status", status 113ee4fc2aSCody Peter Mello 12*e98dc02aSDan McDonald status = system("kill -KILL $$") 133ee4fc2aSCody Peter Mello print "death by signal status", status 143ee4fc2aSCody Peter Mello 153ee4fc2aSCody Peter Mello status = system("cd $WORKDIR && kill -ABRT $$") 163ee4fc2aSCody Peter Mello print "death by signal with core dump status", status 173ee4fc2aSCody Peter Mello 183ee4fc2aSCody Peter Mello system("rm -f core*") 193ee4fc2aSCody Peter Mello} 20