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