xref: /illumos-gate/usr/src/test/util-tests/tests/awk/bugs-fixed/system-status.awk (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
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
8BEGIN {
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}
20