summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
committersjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
commitd7cd1d425cc1ea9451fa235e3af9b6625c3e0de2 (patch)
treeb04f4bd7cd887f50e7d98af35f46b9834ff86c80 /usr.bin
parent3c8e37b1d04827f33c0c9a7594bd1b1ef7cdb3d3 (diff)
parent4fbde208c6460d576f64d6dc3cdc6cab085a4283 (diff)
downloadFreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.zip
FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.tar.gz
Merge head from 7/28
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/Makefile16
-rw-r--r--usr.bin/Makefile.ia643
-rw-r--r--usr.bin/ar/ar.12
-rw-r--r--usr.bin/at/at.man7
-rw-r--r--usr.bin/bc/Makefile.depend1
-rw-r--r--usr.bin/bluetooth/bthost/bthost.12
-rw-r--r--usr.bin/bluetooth/btsockstat/btsockstat.12
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.12
-rw-r--r--usr.bin/bmake/Makefile5
-rw-r--r--usr.bin/bmake/Makefile.inc7
-rw-r--r--usr.bin/bmake/config.h13
-rw-r--r--usr.bin/bmake/tests/Makefile (renamed from usr.bin/make/tests/Makefile)2
-rw-r--r--usr.bin/bmake/tests/README (renamed from usr.bin/make/tests/README)0
-rw-r--r--usr.bin/bmake/tests/archives/Makefile (renamed from usr.bin/make/tests/archives/Makefile)2
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/Makefile (renamed from usr.bin/make/tests/archives/fmt_44bsd/Makefile)2
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test (renamed from usr.bin/make/tests/archives/fmt_44bsd/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.status.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh (renamed from usr.bin/make/tests/archives/fmt_44bsd/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a (renamed from usr.bin/make/tests/archives/fmt_44bsd/libtest.a)bin2104 -> 2104 bytes
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile)2
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7 (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a (renamed from usr.bin/make/tests/archives/fmt_44bsd_mod/libtest.a)bin2104 -> 2104 bytes
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile (renamed from usr.bin/make/tests/archives/fmt_oldbsd/Makefile)2
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test (renamed from usr.bin/make/tests/archives/fmt_oldbsd/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.status.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.3)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.4)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.5)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.6)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7 (renamed from usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.7)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh (renamed from usr.bin/make/tests/archives/fmt_oldbsd/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a (renamed from usr.bin/make/tests/archives/fmt_oldbsd/libtest.a)bin2016 -> 2016 bytes
-rw-r--r--usr.bin/bmake/tests/basic/Makefile (renamed from usr.bin/make/tests/basic/Makefile)2
-rw-r--r--usr.bin/bmake/tests/basic/t0/Makefile (renamed from usr.bin/make/tests/basic/t3/Makefile)2
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.status.1 (renamed from usr.bin/make/tests/basic/t0/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.stderr.1 (renamed from usr.bin/make/tests/basic/t0/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t0/expected.stdout.1 (renamed from usr.bin/make/tests/basic/t0/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t0/legacy_test.sh (renamed from usr.bin/make/tests/basic/t0/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/basic/t1/Makefile (renamed from usr.bin/make/tests/basic/t2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/basic/t1/Makefile.test (renamed from usr.bin/make/tests/basic/t1/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.status.1 (renamed from usr.bin/make/tests/basic/t1/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.stderr.1 (renamed from usr.bin/make/tests/basic/t1/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t1/expected.stdout.1 (renamed from usr.bin/make/tests/basic/t1/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t1/legacy_test.sh (renamed from usr.bin/make/tests/basic/t1/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/basic/t2/Makefile (renamed from usr.bin/make/tests/basic/t1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/basic/t2/Makefile.test (renamed from usr.bin/make/tests/basic/t2/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.status.1 (renamed from usr.bin/make/tests/basic/t2/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.stderr.1 (renamed from usr.bin/make/tests/basic/t2/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t2/expected.stdout.1 (renamed from usr.bin/make/tests/basic/t2/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t2/legacy_test.sh (renamed from usr.bin/make/tests/basic/t2/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/basic/t3/Makefile (renamed from usr.bin/make/tests/basic/t0/Makefile)2
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.status.1 (renamed from usr.bin/make/tests/basic/t3/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.stderr.1 (renamed from usr.bin/make/tests/basic/t3/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t3/expected.stdout.1 (renamed from usr.bin/make/tests/basic/t3/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/basic/t3/legacy_test.sh (renamed from usr.bin/make/tests/basic/t3/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/common.sh (renamed from usr.bin/make/tests/common.sh)0
-rw-r--r--usr.bin/bmake/tests/execution/Makefile (renamed from usr.bin/make/tests/execution/Makefile)2
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/Makefile (renamed from usr.bin/make/tests/execution/ellipsis/Makefile)2
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/Makefile.test (renamed from usr.bin/make/tests/execution/ellipsis/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.status.1 (renamed from usr.bin/make/tests/execution/ellipsis/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1 (renamed from usr.bin/make/tests/execution/ellipsis/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1 (renamed from usr.bin/make/tests/execution/ellipsis/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh (renamed from usr.bin/make/tests/execution/ellipsis/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/execution/empty/Makefile (renamed from usr.bin/make/tests/execution/joberr/Makefile)2
-rw-r--r--usr.bin/bmake/tests/execution/empty/Makefile.test (renamed from usr.bin/make/tests/execution/empty/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.status.1 (renamed from usr.bin/make/tests/execution/empty/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.stderr.1 (renamed from usr.bin/make/tests/execution/empty/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/execution/empty/expected.stdout.1 (renamed from usr.bin/make/tests/execution/empty/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/execution/empty/legacy_test.sh (renamed from usr.bin/make/tests/execution/empty/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/execution/joberr/Makefile (renamed from usr.bin/make/tests/execution/empty/Makefile)2
-rw-r--r--usr.bin/bmake/tests/execution/joberr/Makefile.test (renamed from usr.bin/make/tests/execution/joberr/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.status.1 (renamed from usr.bin/make/tests/execution/joberr/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.stderr.1 (renamed from usr.bin/make/tests/execution/joberr/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/execution/joberr/expected.stdout.1 (renamed from usr.bin/make/tests/execution/joberr/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/execution/joberr/legacy_test.sh (renamed from usr.bin/make/tests/execution/joberr/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/execution/plus/Makefile (renamed from usr.bin/make/tests/execution/plus/Makefile)2
-rw-r--r--usr.bin/bmake/tests/execution/plus/Makefile.test (renamed from usr.bin/make/tests/execution/plus/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.status.1 (renamed from usr.bin/make/tests/execution/plus/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.stderr.1 (renamed from usr.bin/make/tests/execution/plus/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/execution/plus/expected.stdout.1 (renamed from usr.bin/make/tests/execution/plus/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/execution/plus/legacy_test.sh (renamed from usr.bin/make/tests/execution/plus/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/Makefile (renamed from usr.bin/make/tests/shell/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/builtin/Makefile (renamed from usr.bin/make/tests/shell/builtin/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/builtin/Makefile.test (renamed from usr.bin/make/tests/shell/builtin/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.status.1 (renamed from usr.bin/make/tests/shell/builtin/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.status.2 (renamed from usr.bin/make/tests/shell/builtin/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stderr.1 (renamed from usr.bin/make/tests/shell/builtin/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stderr.2 (renamed from usr.bin/make/tests/shell/builtin/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stdout.1 (renamed from usr.bin/make/tests/shell/builtin/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/expected.stdout.2 (renamed from usr.bin/make/tests/shell/builtin/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/legacy_test.sh (renamed from usr.bin/make/tests/shell/builtin/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/builtin/sh (renamed from usr.bin/make/tests/shell/builtin/sh)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/Makefile (renamed from usr.bin/make/tests/shell/meta/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/meta/Makefile.test (renamed from usr.bin/make/tests/shell/meta/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.status.1 (renamed from usr.bin/make/tests/shell/meta/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.status.2 (renamed from usr.bin/make/tests/shell/meta/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stderr.1 (renamed from usr.bin/make/tests/shell/meta/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stderr.2 (renamed from usr.bin/make/tests/shell/meta/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stdout.1 (renamed from usr.bin/make/tests/shell/meta/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/expected.stdout.2 (renamed from usr.bin/make/tests/shell/meta/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/legacy_test.sh (renamed from usr.bin/make/tests/shell/meta/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/meta/sh (renamed from usr.bin/make/tests/shell/meta/sh)0
-rw-r--r--usr.bin/bmake/tests/shell/path/Makefile (renamed from usr.bin/make/tests/shell/path/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/path/Makefile.test (renamed from usr.bin/make/tests/shell/path/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.status.1 (renamed from usr.bin/make/tests/shell/path/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.status.2 (renamed from usr.bin/make/tests/shell/path/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stderr.1 (renamed from usr.bin/make/tests/shell/path/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stderr.2 (renamed from usr.bin/make/tests/shell/path/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stdout.1 (renamed from usr.bin/make/tests/shell/path/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path/expected.stdout.2 (renamed from usr.bin/make/tests/shell/path/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path/legacy_test.sh (renamed from usr.bin/make/tests/shell/path/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/path/sh (renamed from usr.bin/make/tests/shell/path/sh)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/Makefile (renamed from usr.bin/make/tests/shell/path_select/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/path_select/Makefile.test (renamed from usr.bin/make/tests/shell/path_select/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.status.1 (renamed from usr.bin/make/tests/shell/path_select/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.status.2 (renamed from usr.bin/make/tests/shell/path_select/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stderr.1 (renamed from usr.bin/make/tests/shell/path_select/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stderr.2 (renamed from usr.bin/make/tests/shell/path_select/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stdout.1 (renamed from usr.bin/make/tests/shell/path_select/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/expected.stdout.2 (renamed from usr.bin/make/tests/shell/path_select/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/legacy_test.sh (renamed from usr.bin/make/tests/shell/path_select/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/path_select/shell (renamed from usr.bin/make/tests/shell/path_select/shell)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/Makefile (renamed from usr.bin/make/tests/shell/replace/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/replace/Makefile.test (renamed from usr.bin/make/tests/shell/replace/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.status.1 (renamed from usr.bin/make/tests/shell/replace/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.status.2 (renamed from usr.bin/make/tests/shell/replace/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stderr.1 (renamed from usr.bin/make/tests/shell/replace/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stderr.2 (renamed from usr.bin/make/tests/shell/replace/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stdout.1 (renamed from usr.bin/make/tests/shell/replace/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/expected.stdout.2 (renamed from usr.bin/make/tests/shell/replace/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/legacy_test.sh (renamed from usr.bin/make/tests/shell/replace/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/shell/replace/shell (renamed from usr.bin/make/tests/shell/replace/shell)0
-rw-r--r--usr.bin/bmake/tests/shell/select/Makefile (renamed from usr.bin/make/tests/shell/select/Makefile)2
-rw-r--r--usr.bin/bmake/tests/shell/select/Makefile.test (renamed from usr.bin/make/tests/shell/select/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.status.1 (renamed from usr.bin/make/tests/shell/select/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.status.2 (renamed from usr.bin/make/tests/shell/select/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stderr.1 (renamed from usr.bin/make/tests/shell/select/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stderr.2 (renamed from usr.bin/make/tests/shell/select/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stdout.1 (renamed from usr.bin/make/tests/shell/select/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/shell/select/expected.stdout.2 (renamed from usr.bin/make/tests/shell/select/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/shell/select/legacy_test.sh (renamed from usr.bin/make/tests/shell/select/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/suffixes/Makefile (renamed from usr.bin/make/tests/suffixes/Makefile)2
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/Makefile (renamed from usr.bin/make/tests/suffixes/basic/Makefile)2
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/Makefile.test (renamed from usr.bin/make/tests/suffixes/basic/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/TEST1.a (renamed from usr.bin/make/tests/suffixes/basic/TEST1.a)0
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.status.1 (renamed from usr.bin/make/tests/suffixes/basic/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.stderr.1 (renamed from usr.bin/make/tests/suffixes/basic/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/expected.stdout.1 (renamed from usr.bin/make/tests/suffixes/basic/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/basic/legacy_test.sh (renamed from usr.bin/make/tests/suffixes/basic/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/Makefile (renamed from usr.bin/make/tests/suffixes/src_wild1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test (renamed from usr.bin/make/tests/suffixes/src_wild1/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a (renamed from usr.bin/make/tests/suffixes/src_wild1/TEST1.a)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a (renamed from usr.bin/make/tests/suffixes/src_wild1/TEST2.a)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1 (renamed from usr.bin/make/tests/suffixes/src_wild1/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1 (renamed from usr.bin/make/tests/suffixes/src_wild1/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1 (renamed from usr.bin/make/tests/suffixes/src_wild1/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh (renamed from usr.bin/make/tests/suffixes/src_wild1/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/Makefile (renamed from usr.bin/make/tests/suffixes/src_wild2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test (renamed from usr.bin/make/tests/suffixes/src_wild2/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a (renamed from usr.bin/make/tests/suffixes/src_wild2/TEST1.a)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a (renamed from usr.bin/make/tests/suffixes/src_wild2/TEST2.a)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1 (renamed from usr.bin/make/tests/suffixes/src_wild2/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1 (renamed from usr.bin/make/tests/suffixes/src_wild2/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1 (renamed from usr.bin/make/tests/suffixes/src_wild2/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh (renamed from usr.bin/make/tests/suffixes/src_wild2/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/syntax/Makefile (renamed from usr.bin/make/tests/syntax/Makefile)2
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/Makefile13
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/Makefile.test (renamed from usr.bin/make/tests/syntax/directive-t0/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.status.1 (renamed from usr.bin/make/tests/syntax/directive-t0/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1 (renamed from usr.bin/make/tests/syntax/directive-t0/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1 (renamed from usr.bin/make/tests/syntax/directive-t0/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh (renamed from usr.bin/make/tests/syntax/directive-t0/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/Makefile (renamed from usr.bin/make/tests/syntax/enl/Makefile)2
-rw-r--r--usr.bin/bmake/tests/syntax/enl/Makefile.test (renamed from usr.bin/make/tests/syntax/enl/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.1 (renamed from usr.bin/make/tests/syntax/enl/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.2 (renamed from usr.bin/make/tests/syntax/enl/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.3 (renamed from usr.bin/make/tests/syntax/enl/expected.status.3)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.4 (renamed from usr.bin/make/tests/syntax/enl/expected.status.4)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.status.5 (renamed from usr.bin/make/tests/syntax/enl/expected.status.5)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.1 (renamed from usr.bin/make/tests/syntax/enl/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.2 (renamed from usr.bin/make/tests/syntax/enl/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.3 (renamed from usr.bin/make/tests/syntax/enl/expected.stderr.3)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.4 (renamed from usr.bin/make/tests/syntax/enl/expected.stderr.4)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stderr.5 (renamed from usr.bin/make/tests/syntax/enl/expected.stderr.5)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.1 (renamed from usr.bin/make/tests/syntax/enl/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.2 (renamed from usr.bin/make/tests/syntax/enl/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.3 (renamed from usr.bin/make/tests/syntax/enl/expected.stdout.3)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.4 (renamed from usr.bin/make/tests/syntax/enl/expected.stdout.4)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/expected.stdout.5 (renamed from usr.bin/make/tests/syntax/enl/expected.stdout.5)0
-rw-r--r--usr.bin/bmake/tests/syntax/enl/legacy_test.sh (renamed from usr.bin/make/tests/syntax/enl/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/Makefile (renamed from usr.bin/make/tests/syntax/funny-targets/Makefile)2
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/Makefile.test (renamed from usr.bin/make/tests/syntax/funny-targets/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.status.1 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.status.2 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2 (renamed from usr.bin/make/tests/syntax/funny-targets/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh (renamed from usr.bin/make/tests/syntax/funny-targets/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/Makefile (renamed from usr.bin/make/tests/syntax/semi/Makefile)2
-rw-r--r--usr.bin/bmake/tests/syntax/semi/Makefile.test (renamed from usr.bin/make/tests/syntax/semi/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.status.1 (renamed from usr.bin/make/tests/syntax/semi/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.status.2 (renamed from usr.bin/make/tests/syntax/semi/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stderr.1 (renamed from usr.bin/make/tests/syntax/semi/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stderr.2 (renamed from usr.bin/make/tests/syntax/semi/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stdout.1 (renamed from usr.bin/make/tests/syntax/semi/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/expected.stdout.2 (renamed from usr.bin/make/tests/syntax/semi/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/syntax/semi/legacy_test.sh (renamed from usr.bin/make/tests/syntax/semi/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/sysmk/Makefile (renamed from usr.bin/make/tests/sysmk/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/Makefile (renamed from usr.bin/make/tests/variables/t0/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test (renamed from usr.bin/make/tests/sysmk/t0/2/1/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1 (renamed from usr.bin/make/tests/sysmk/t0/2/1/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1 (renamed from usr.bin/make/tests/sysmk/t0/2/1/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1 (renamed from usr.bin/make/tests/sysmk/t0/2/1/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh (renamed from usr.bin/make/tests/sysmk/t0/2/1/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/2/Makefile (renamed from usr.bin/make/tests/sysmk/t2/2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/Makefile (renamed from usr.bin/make/tests/sysmk/t1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/mk/Makefile (renamed from usr.bin/make/tests/sysmk/t0/mk/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test (renamed from usr.bin/make/tests/sysmk/t0/mk/sys.mk.test)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/Makefile (renamed from usr.bin/make/tests/sysmk/t1/2/1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/cleanup (renamed from usr.bin/make/tests/sysmk/t1/2/1/cleanup)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1 (renamed from usr.bin/make/tests/sysmk/t1/2/1/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1 (renamed from usr.bin/make/tests/sysmk/t1/2/1/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1 (renamed from usr.bin/make/tests/sysmk/t1/2/1/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh (renamed from usr.bin/make/tests/sysmk/t1/2/1/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/2/Makefile (renamed from usr.bin/make/tests/sysmk/t0/2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/Makefile (renamed from usr.bin/make/tests/sysmk/t2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/mk/Makefile (renamed from usr.bin/make/tests/sysmk/t1/mk/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test (renamed from usr.bin/make/tests/sysmk/t1/mk/sys.mk.test)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/Makefile (renamed from usr.bin/make/tests/sysmk/t2/2/1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/cleanup (renamed from usr.bin/make/tests/sysmk/t2/2/1/cleanup)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1 (renamed from usr.bin/make/tests/sysmk/t2/2/1/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1 (renamed from usr.bin/make/tests/sysmk/t2/2/1/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1 (renamed from usr.bin/make/tests/sysmk/t2/2/1/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh (renamed from usr.bin/make/tests/sysmk/t2/2/1/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/2/Makefile (renamed from usr.bin/make/tests/sysmk/t1/2/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/Makefile (renamed from usr.bin/make/tests/sysmk/t0/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/mk/Makefile (renamed from usr.bin/make/tests/sysmk/t2/mk/Makefile)2
-rw-r--r--usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test (renamed from usr.bin/make/tests/sysmk/t2/mk/sys.mk.test)0
-rw-r--r--usr.bin/bmake/tests/test-new.mk (renamed from usr.bin/make/tests/test-new.mk)0
-rw-r--r--usr.bin/bmake/tests/variables/Makefile (renamed from usr.bin/make/tests/variables/Makefile)2
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/Makefile13
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/Makefile.test (renamed from usr.bin/make/tests/variables/modifier_M/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.status.1 (renamed from usr.bin/make/tests/variables/modifier_M/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1 (renamed from usr.bin/make/tests/variables/modifier_M/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1 (renamed from usr.bin/make/tests/variables/modifier_M/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh (renamed from usr.bin/make/tests/variables/modifier_M/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/Makefile (renamed from usr.bin/make/tests/variables/modifier_t/Makefile)2
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/Makefile.test (renamed from usr.bin/make/tests/variables/modifier_t/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.1 (renamed from usr.bin/make/tests/variables/modifier_t/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.2 (renamed from usr.bin/make/tests/variables/modifier_t/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.status.3 (renamed from usr.bin/make/tests/variables/modifier_t/expected.status.3)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stderr.3)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3 (renamed from usr.bin/make/tests/variables/modifier_t/expected.stdout.3)0
-rw-r--r--usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh (renamed from usr.bin/make/tests/variables/modifier_t/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/Makefile (renamed from usr.bin/make/tests/variables/opt_V/Makefile)2
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/Makefile.test (renamed from usr.bin/make/tests/variables/opt_V/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.status.1 (renamed from usr.bin/make/tests/variables/opt_V/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.status.2 (renamed from usr.bin/make/tests/variables/opt_V/expected.status.2)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stderr.1 (renamed from usr.bin/make/tests/variables/opt_V/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stderr.2 (renamed from usr.bin/make/tests/variables/opt_V/expected.stderr.2)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stdout.1 (renamed from usr.bin/make/tests/variables/opt_V/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/expected.stdout.2 (renamed from usr.bin/make/tests/variables/opt_V/expected.stdout.2)0
-rw-r--r--usr.bin/bmake/tests/variables/opt_V/legacy_test.sh (renamed from usr.bin/make/tests/variables/opt_V/legacy_test.sh)0
-rw-r--r--usr.bin/bmake/tests/variables/t0/Makefile (renamed from usr.bin/make/tests/sysmk/t0/2/1/Makefile)2
-rw-r--r--usr.bin/bmake/tests/variables/t0/Makefile.test (renamed from usr.bin/make/tests/variables/t0/Makefile.test)0
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.status.1 (renamed from usr.bin/make/tests/variables/t0/expected.status.1)0
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.stderr.1 (renamed from usr.bin/make/tests/variables/t0/expected.stderr.1)0
-rw-r--r--usr.bin/bmake/tests/variables/t0/expected.stdout.1 (renamed from usr.bin/make/tests/variables/t0/expected.stdout.1)0
-rw-r--r--usr.bin/bmake/tests/variables/t0/legacy_test.sh (renamed from usr.bin/make/tests/variables/t0/legacy_test.sh)0
-rw-r--r--usr.bin/brandelf/brandelf.12
-rw-r--r--usr.bin/bsdiff/bsdiff/bsdiff.12
-rw-r--r--usr.bin/bsdiff/bspatch/bspatch.12
-rw-r--r--usr.bin/calendar/Makefile1
-rw-r--r--usr.bin/calendar/calendars/calendar.freebsd4
-rw-r--r--usr.bin/calendar/calendars/calendar.holiday2
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile2
-rw-r--r--usr.bin/clang/clang-tblgen/Makefile.depend2
-rw-r--r--usr.bin/clang/clang.prog.mk6
-rw-r--r--usr.bin/clang/clang/Makefile4
-rw-r--r--usr.bin/clang/clang/Makefile.depend2
-rw-r--r--usr.bin/clang/tblgen/Makefile2
-rw-r--r--usr.bin/clang/tblgen/Makefile.depend2
-rw-r--r--usr.bin/compile_et/Makefile2
-rw-r--r--usr.bin/cpuset/cpuset.12
-rw-r--r--usr.bin/ctlstat/ctlstat.84
-rw-r--r--usr.bin/dtc/dtc.cc2
-rw-r--r--usr.bin/dtc/fdt.cc9
-rw-r--r--usr.bin/dtc/input_buffer.cc9
-rw-r--r--usr.bin/ee/Makefile4
-rw-r--r--usr.bin/ee/Makefile.depend2
-rw-r--r--usr.bin/elf2aout/elf2aout.14
-rw-r--r--usr.bin/elfdump/elfdump.14
-rw-r--r--usr.bin/elfdump/elfdump.c161
-rw-r--r--usr.bin/fetch/fetch.18
-rw-r--r--usr.bin/file/Makefile3
-rw-r--r--usr.bin/fstat/fuser.12
-rw-r--r--usr.bin/ftp/Makefile4
-rw-r--r--usr.bin/ftp/Makefile.depend1
-rw-r--r--usr.bin/gcore/Makefile4
-rw-r--r--usr.bin/gcore/elf32core.c66
-rw-r--r--usr.bin/gcore/elfcore.c68
-rw-r--r--usr.bin/getconf/Makefile.depend1
-rw-r--r--usr.bin/getconf/getconf.12
-rw-r--r--usr.bin/gprof/gprof.h3
-rw-r--r--usr.bin/grep/Makefile.depend1
-rw-r--r--usr.bin/grep/grep.c9
-rw-r--r--usr.bin/grep/queue.c16
-rw-r--r--usr.bin/grep/util.c4
-rw-r--r--usr.bin/gzip/gzip.14
-rw-r--r--usr.bin/gzip/zuncompress.c2
-rw-r--r--usr.bin/iconv/iconv.c27
-rw-r--r--usr.bin/ipcs/ipcs.12
-rw-r--r--usr.bin/iscsictl/iscsictl.825
-rw-r--r--usr.bin/iscsictl/iscsictl.c173
-rw-r--r--usr.bin/kdump/Makefile.depend1
-rw-r--r--usr.bin/ktrdump/ktrdump.84
-rw-r--r--usr.bin/ldd/ldd.12
-rw-r--r--usr.bin/less/Makefile4
-rw-r--r--usr.bin/less/Makefile.depend2
-rw-r--r--usr.bin/lessecho/Makefile.depend1
-rw-r--r--usr.bin/lesskey/Makefile.depend1
-rw-r--r--usr.bin/lockf/lockf.12
-rw-r--r--usr.bin/logins/logins.12
-rw-r--r--usr.bin/look/look.112
-rw-r--r--usr.bin/look/look.c14
-rw-r--r--usr.bin/m4/Makefile7
-rw-r--r--usr.bin/m4/eval.c16
-rw-r--r--usr.bin/m4/extern.h8
-rw-r--r--usr.bin/m4/gnum4.c58
-rw-r--r--usr.bin/m4/lib/ohash.c330
-rw-r--r--usr.bin/m4/lib/ohash.h23
-rw-r--r--usr.bin/m4/lib/ohash_create_entry.c40
-rw-r--r--usr.bin/m4/lib/ohash_delete.c33
-rw-r--r--usr.bin/m4/lib/ohash_do.c113
-rw-r--r--usr.bin/m4/lib/ohash_entries.c28
-rw-r--r--usr.bin/m4/lib/ohash_enum.c38
-rw-r--r--usr.bin/m4/lib/ohash_init.356
-rw-r--r--usr.bin/m4/lib/ohash_init.c43
-rw-r--r--usr.bin/m4/lib/ohash_int.h25
-rw-r--r--usr.bin/m4/lib/ohash_interval.311
-rw-r--r--usr.bin/m4/lib/ohash_interval.c38
-rw-r--r--usr.bin/m4/lib/ohash_lookup_interval.c70
-rw-r--r--usr.bin/m4/lib/ohash_lookup_memory.c66
-rw-r--r--usr.bin/m4/lib/ohash_qlookup.c29
-rw-r--r--usr.bin/m4/lib/ohash_qlookupi.c31
-rw-r--r--usr.bin/m4/look.c18
-rw-r--r--usr.bin/m4/m4.134
-rw-r--r--usr.bin/m4/main.c11
-rw-r--r--usr.bin/m4/misc.c70
-rw-r--r--usr.bin/make/Makefile5
-rw-r--r--usr.bin/make/tests/syntax/directive-t0/Makefile13
-rw-r--r--usr.bin/make/tests/variables/modifier_M/Makefile13
-rw-r--r--usr.bin/mandoc/Makefile2
-rw-r--r--usr.bin/mesg/mesg.c6
-rw-r--r--usr.bin/mkcsmapper/mkcsmapper.12
-rw-r--r--usr.bin/mkesdb/mkesdb.12
-rw-r--r--usr.bin/mkimg/Makefile8
-rw-r--r--usr.bin/mkimg/apm.c18
-rw-r--r--usr.bin/mkimg/bsd.c13
-rw-r--r--usr.bin/mkimg/ebr.c5
-rw-r--r--usr.bin/mkimg/format.c91
-rw-r--r--usr.bin/mkimg/format.h49
-rw-r--r--usr.bin/mkimg/gpt.c26
-rw-r--r--usr.bin/mkimg/image.c230
-rw-r--r--usr.bin/mkimg/image.h44
-rw-r--r--usr.bin/mkimg/mbr.c5
-rw-r--r--usr.bin/mkimg/mkimg.142
-rw-r--r--usr.bin/mkimg/mkimg.c198
-rw-r--r--usr.bin/mkimg/mkimg.h12
-rw-r--r--usr.bin/mkimg/pc98.c5
-rw-r--r--usr.bin/mkimg/raw.c62
-rw-r--r--usr.bin/mkimg/scheme.c21
-rw-r--r--usr.bin/mkimg/scheme.h4
-rw-r--r--usr.bin/mkimg/vhd.c386
-rw-r--r--usr.bin/mkimg/vmdk.c243
-rw-r--r--usr.bin/mkimg/vtoc8.c11
-rw-r--r--usr.bin/mkulzma/mkulzma.84
-rw-r--r--usr.bin/mkuzip/mkuzip.82
-rw-r--r--usr.bin/msgs/Makefile4
-rw-r--r--usr.bin/msgs/Makefile.depend1
-rw-r--r--usr.bin/ncal/Makefile4
-rw-r--r--usr.bin/ncal/Makefile.depend1
-rw-r--r--usr.bin/ncal/ncal.12
-rw-r--r--usr.bin/netstat/inet.c14
-rw-r--r--usr.bin/netstat/main.c22
-rw-r--r--usr.bin/netstat/netstat.1744
-rw-r--r--usr.bin/netstat/netstat.h1
-rw-r--r--usr.bin/netstat/route.c26
-rw-r--r--usr.bin/patch/patch.115
-rw-r--r--usr.bin/patch/patch.c15
-rw-r--r--usr.bin/patch/pch.c37
-rw-r--r--usr.bin/patch/pch.h2
-rw-r--r--usr.bin/printf/printf.c35
-rw-r--r--usr.bin/printf/tests/Makefile1
-rw-r--r--usr.bin/printf/tests/regress.m2.out1
-rw-r--r--usr.bin/printf/tests/regress.missingpos1.out1
-rw-r--r--usr.bin/printf/tests/regress.sh10
-rw-r--r--usr.bin/procstat/Makefile1
-rw-r--r--usr.bin/procstat/procstat.196
-rw-r--r--usr.bin/procstat/procstat.c25
-rw-r--r--usr.bin/procstat/procstat.h3
-rw-r--r--usr.bin/procstat/procstat_files.c7
-rw-r--r--usr.bin/procstat/procstat_rusage.c161
-rw-r--r--usr.bin/procstat/procstat_vm.c4
-rw-r--r--usr.bin/rctl/rctl.82
-rw-r--r--usr.bin/revoke/revoke.12
-rw-r--r--usr.bin/rpcgen/rpc_main.c4
-rw-r--r--usr.bin/rpcgen/rpc_sample.c1
-rw-r--r--usr.bin/sed/main.c17
-rw-r--r--usr.bin/sed/sed.18
-rw-r--r--usr.bin/send-pr/Makefile5
-rwxr-xr-xusr.bin/send-pr/send-pr.sh11
-rw-r--r--usr.bin/showmount/showmount.83
-rw-r--r--usr.bin/sockstat/sockstat.12
-rw-r--r--usr.bin/sort/Makefile.depend1
-rw-r--r--usr.bin/ssh-copy-id/ssh-copy-id.14
-rw-r--r--usr.bin/stat/stat.17
-rw-r--r--usr.bin/stat/stat.c37
-rw-r--r--usr.bin/svn/lib/libapr/Makefile4
-rw-r--r--usr.bin/svn/lib/libapr/apr.h18
-rw-r--r--usr.bin/svn/lib/libapr/apr_private.h7
-rw-r--r--usr.bin/svn/svn/Makefile8
-rw-r--r--usr.bin/svn/svn_private_config.h4
-rw-r--r--usr.bin/svn/svnadmin/Makefile2
-rw-r--r--usr.bin/svn/svndumpfilter/Makefile2
-rw-r--r--usr.bin/svn/svnlook/Makefile2
-rw-r--r--usr.bin/svn/svnmucc/Makefile2
-rw-r--r--usr.bin/svn/svnrdump/Makefile2
-rw-r--r--usr.bin/svn/svnserve/Makefile2
-rw-r--r--usr.bin/svn/svnsync/Makefile2
-rw-r--r--usr.bin/svn/svnversion/Makefile2
-rw-r--r--usr.bin/systat/Makefile13
-rw-r--r--usr.bin/systat/ifstat.c29
-rw-r--r--usr.bin/systat/main.c78
-rw-r--r--usr.bin/systat/systat.118
-rw-r--r--usr.bin/tabs/Makefile4
-rw-r--r--usr.bin/tabs/Makefile.depend1
-rw-r--r--usr.bin/telnet/Makefile8
-rw-r--r--usr.bin/telnet/Makefile.depend1
-rw-r--r--usr.bin/tftp/Makefile4
-rw-r--r--usr.bin/tftp/Makefile.depend2
-rw-r--r--usr.bin/timeout/Makefile5
-rw-r--r--usr.bin/timeout/Makefile.depend19
-rw-r--r--usr.bin/timeout/timeout.1114
-rw-r--r--usr.bin/timeout/timeout.c333
-rw-r--r--usr.bin/top/Makefile.depend1
-rw-r--r--usr.bin/top/machine.c116
-rw-r--r--usr.bin/tput/Makefile4
-rw-r--r--usr.bin/tput/Makefile.depend1
-rw-r--r--usr.bin/truncate/Makefile6
-rw-r--r--usr.bin/truncate/tests/Makefile6
-rw-r--r--usr.bin/truncate/tests/truncate_test.sh402
-rw-r--r--usr.bin/truncate/truncate.13
-rw-r--r--usr.bin/truncate/truncate.c12
-rw-r--r--usr.bin/truss/Makefile.depend.amd641
-rw-r--r--usr.bin/truss/extern.h4
-rw-r--r--usr.bin/truss/ia64-fbsd.c314
-rw-r--r--usr.bin/truss/main.c3
-rw-r--r--usr.bin/tset/Makefile5
-rw-r--r--usr.bin/tset/Makefile.depend1
-rw-r--r--usr.bin/ul/Makefile4
-rw-r--r--usr.bin/ul/Makefile.depend1
-rw-r--r--usr.bin/unifdef/unifdef.15
-rw-r--r--usr.bin/units/Makefile10
-rw-r--r--usr.bin/units/Makefile.depend2
-rw-r--r--usr.bin/units/tests/Makefile9
-rw-r--r--usr.bin/units/tests/basics_test.sh22
-rw-r--r--usr.bin/units/units.132
-rw-r--r--usr.bin/units/units.c147
-rw-r--r--usr.bin/units/units.lib62
-rw-r--r--usr.bin/unzip/unzip.14
-rw-r--r--usr.bin/users/Makefile4
-rw-r--r--usr.bin/users/Makefile.depend3
-rw-r--r--usr.bin/users/users.c116
-rw-r--r--usr.bin/users/users.cc (renamed from usr.bin/gprof/ia64.h)49
-rw-r--r--usr.bin/vacation/Makefile2
-rw-r--r--usr.bin/vi/Makefile5
-rw-r--r--usr.bin/vmstat/vmstat.c12
-rw-r--r--usr.bin/vtfontcvt/Makefile8
-rw-r--r--usr.bin/vtfontcvt/Makefile.depend19
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.874
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.c567
-rw-r--r--usr.bin/which/which.14
-rw-r--r--usr.bin/whois/whois.c10
-rw-r--r--usr.bin/xlint/arch/ia64/targparam.h54
-rw-r--r--usr.bin/xlint/lint1/Makefile.depend1
-rw-r--r--usr.bin/xlint/lint1/param.h5
-rw-r--r--usr.bin/yacc/tests/Makefile363
-rw-r--r--usr.bin/yacc/tests/calc.y106
-rw-r--r--usr.bin/yacc/tests/calc1.y305
-rw-r--r--usr.bin/yacc/tests/calc2.y120
-rw-r--r--usr.bin/yacc/tests/calc3.y123
-rw-r--r--usr.bin/yacc/tests/code_calc.y112
-rw-r--r--usr.bin/yacc/tests/code_error.y36
-rw-r--r--usr.bin/yacc/tests/error.y28
-rw-r--r--usr.bin/yacc/tests/ftp.y1228
-rw-r--r--usr.bin/yacc/tests/grammar.y1183
-rw-r--r--usr.bin/yacc/tests/legacy_test.sh6
-rw-r--r--usr.bin/yacc/tests/pure_calc.y116
-rw-r--r--usr.bin/yacc/tests/pure_error.y41
-rw-r--r--usr.bin/yacc/tests/quote_calc.y112
-rw-r--r--usr.bin/yacc/tests/quote_calc2.y112
-rw-r--r--usr.bin/yacc/tests/quote_calc3.y112
-rw-r--r--usr.bin/yacc/tests/quote_calc4.y112
-rw-r--r--usr.bin/yacc/tests/regress.00.out386
-rw-r--r--usr.bin/yacc/tests/regress.01.out589
-rw-r--r--usr.bin/yacc/tests/regress.02.out831
-rw-r--r--usr.bin/yacc/tests/regress.03.out603
-rw-r--r--usr.bin/yacc/tests/regress.04.out595
-rw-r--r--usr.bin/yacc/tests/regress.05.out425
-rw-r--r--usr.bin/yacc/tests/regress.06.out417
-rw-r--r--usr.bin/yacc/tests/regress.07.out1912
-rw-r--r--usr.bin/yacc/tests/regress.08.out1942
-rw-r--r--usr.bin/yacc/tests/regress.09.out599
-rw-r--r--usr.bin/yacc/tests/regress.10.out429
-rw-r--r--usr.bin/yacc/tests/regress.11.out610
-rw-r--r--usr.bin/yacc/tests/regress.12.out610
-rw-r--r--usr.bin/yacc/tests/regress.13.out604
-rw-r--r--usr.bin/yacc/tests/regress.14.out604
-rw-r--r--usr.bin/yacc/tests/regress.sh28
-rw-r--r--usr.bin/yacc/tests/undefined.y5
-rwxr-xr-xusr.bin/yacc/tests/yacc_tests.sh24
-rw-r--r--usr.bin/yes/yes.15
-rw-r--r--usr.bin/ypcat/ypcat.12
-rw-r--r--usr.bin/ypmatch/ypmatch.12
587 files changed, 5913 insertions, 17261 deletions
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 6df995a..353816a 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -12,7 +12,6 @@
SUBDIR= alias \
apply \
asa \
- ${_atf} \
awk \
banner \
basename \
@@ -144,6 +143,7 @@ SUBDIR= alias \
rwall \
script \
sed \
+ send-pr \
seq \
shar \
showmount \
@@ -163,6 +163,7 @@ SUBDIR= alias \
${_tests} \
tftp \
time \
+ timeout \
tip \
top \
touch \
@@ -230,6 +231,10 @@ SUBDIR+= calendar
_clang= clang
.endif
+.if ${MK_FMAKE} != "no"
+SUBDIR+= make
+.endif
+
.if ${MK_GPL_DTC} != "yes"
SUBDIR+= dtc
.endif
@@ -262,10 +267,6 @@ SUBDIR+= drill
SUBDIR+= host
.endif
-.if ${MK_LIBTHR} != "no"
-SUBDIR+= csup
-.endif
-
.if ${MK_LOCATE} != "no"
SUBDIR+= locate
.endif
@@ -329,7 +330,6 @@ SUBDIR+= telnet
.endif
.if ${MK_TESTS} != "no"
-_atf= atf
_tests= tests
.endif
@@ -360,6 +360,10 @@ SUBDIR+= yacc
SUBDIR+= vi
.endif
+.if ${MK_VT} != "no"
+SUBDIR+= vtfontcvt
+.endif
+
.if ${MK_USB} != "no"
SUBDIR+= usbhidaction
SUBDIR+= usbhidctl
diff --git a/usr.bin/Makefile.ia64 b/usr.bin/Makefile.ia64
deleted file mode 100644
index fee2fb0..0000000
--- a/usr.bin/Makefile.ia64
+++ /dev/null
@@ -1,3 +0,0 @@
-# $FreeBSD$
-
-SUBDIR+= smbutil
diff --git a/usr.bin/ar/ar.1 b/usr.bin/ar/ar.1
index 2c4deae..1ef8c89 100644
--- a/usr.bin/ar/ar.1
+++ b/usr.bin/ar/ar.1
@@ -570,7 +570,7 @@ An
command first appeared in AT&T UNIX Version 1.
In
.Fx 8.0 ,
-.An "Kai Wang" Aq kaiw@FreeBSD.org
+.An Kai Wang Aq Mt kaiw@FreeBSD.org
reimplemented
.Nm
and
diff --git a/usr.bin/at/at.man b/usr.bin/at/at.man
index a876974..7dc1529 100644
--- a/usr.bin/at/at.man
+++ b/usr.bin/at/at.man
@@ -330,12 +330,13 @@ job-creation lock file
.Xr cron 8 ,
.Xr sendmail 8
.Sh AUTHORS
+.An -nosplit
At was mostly written by
-.An Thomas Koenig Aq ig25@rz.uni-karlsruhe.de .
+.An Thomas Koenig Aq Mt ig25@rz.uni-karlsruhe.de .
The time parsing routines are by
-.An David Parsons Aq orc@pell.chi.il.us ,
+.An David Parsons Aq Mt orc@pell.chi.il.us ,
with minor enhancements by
-.An Joe Halpin Aq joe.halpin@attbi.com .
+.An Joe Halpin Aq Mt joe.halpin@attbi.com .
.Sh BUGS
If the file
.Pa /var/run/utx.active
diff --git a/usr.bin/bc/Makefile.depend b/usr.bin/bc/Makefile.depend
index e13898c..1142419 100644
--- a/usr.bin/bc/Makefile.depend
+++ b/usr.bin/bc/Makefile.depend
@@ -12,6 +12,7 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libedit \
lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.bin/bluetooth/bthost/bthost.1 b/usr.bin/bluetooth/bthost/bthost.1
index e4a4abc..6ee4b08 100644
--- a/usr.bin/bluetooth/bthost/bthost.1
+++ b/usr.bin/bluetooth/bthost/bthost.1
@@ -112,4 +112,4 @@ foo: Unknown Protocol/Service Multiplexor
.Xr bluetooth.hosts 5 ,
.Xr bluetooth.protocols 5
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
diff --git a/usr.bin/bluetooth/btsockstat/btsockstat.1 b/usr.bin/bluetooth/btsockstat/btsockstat.1
index ad5063d..41bf2a1 100644
--- a/usr.bin/bluetooth/btsockstat/btsockstat.1
+++ b/usr.bin/bluetooth/btsockstat/btsockstat.1
@@ -77,7 +77,7 @@ Display a list of active routing entries (if any) for specified protocol.
.Sh SEE ALSO
.Xr ng_btsocket 4
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Most likely.
Please report if found.
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
index 92c7d45..0f60089 100644
--- a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
@@ -181,6 +181,6 @@ can be used to talk to the remote serial port on the server.
.Xr rfcomm_pppd 8 ,
.Xr sdpd 8
.Sh AUTHORS
-.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
.Sh BUGS
Please report if found.
diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
index 4d8fa38..2fc2bee 100644
--- a/usr.bin/bmake/Makefile
+++ b/usr.bin/bmake/Makefile
@@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap
-# $Id: Makefile,v 1.23 2014/01/02 22:20:52 sjg Exp $
+# $Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $
# Base version on src date
-MAKE_VERSION= 20140101
+MAKE_VERSION= 20140620
PROG?= ${.CURDIR:T}
@@ -167,7 +167,6 @@ accept test:
# override some simple things
BINDIR= /usr/bin
MANDIR= /usr/share/man/man
-DEFAULT_SYS_PATH= /usr/share/mk
# make sure we get this
CFLAGS+= ${COPTS.${.IMPSRC:T}}
diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc
index 120cab4..2fa7785 100644
--- a/usr.bin/bmake/Makefile.inc
+++ b/usr.bin/bmake/Makefile.inc
@@ -13,5 +13,12 @@ PROG= make
NO_SHARED?= YES
.endif
+# hack to not add tests to tests subdir since this is included from
+# there and to avoid renaming things that require changes to generated
+# files.
+.if defined(MK_TESTS) && ${MK_TESTS} != no && exists(${.CURDIR}/tests)
+SUBDIR+= tests
+.endif
+
WARNS=3
CFLAGS+= -DNO_PWD_OVERRIDE ${DBG}
diff --git a/usr.bin/bmake/config.h b/usr.bin/bmake/config.h
index 1edb1d3..0e4e32d 100644
--- a/usr.bin/bmake/config.h
+++ b/usr.bin/bmake/config.h
@@ -146,6 +146,9 @@
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#define HAVE_ST_RDEV 1
+/* Define to 1 if you have the `sysctl' function. */
+#define HAVE_SYSCTL 1
+
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
@@ -166,6 +169,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#define HAVE_SYS_SYSCTL_H 1
+
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
@@ -230,7 +236,7 @@
#define PACKAGE_NAME "bmake"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "bmake 20140101"
+#define PACKAGE_STRING "bmake 20140214"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bmake"
@@ -239,7 +245,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "20140101"
+#define PACKAGE_VERSION "20140214"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
@@ -300,6 +306,9 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
+/* C99 function name */
+/* #undef __func__ */
+
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
diff --git a/usr.bin/make/tests/Makefile b/usr.bin/bmake/tests/Makefile
index d5bad60..e225034 100644
--- a/usr.bin/make/tests/Makefile
+++ b/usr.bin/bmake/tests/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake
FILESDIR= ${TESTSDIR}
FILES= common.sh
diff --git a/usr.bin/make/tests/README b/usr.bin/bmake/tests/README
index 1ac209b..1ac209b 100644
--- a/usr.bin/make/tests/README
+++ b/usr.bin/bmake/tests/README
diff --git a/usr.bin/make/tests/archives/Makefile b/usr.bin/bmake/tests/archives/Makefile
index f8944e0..f80ffc2 100644
--- a/usr.bin/make/tests/archives/Makefile
+++ b/usr.bin/bmake/tests/archives/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/archives
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives
TESTS_SUBDIRS= fmt_44bsd fmt_44bsd_mod fmt_oldbsd
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/Makefile b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile
index bf6ad40..15389c8 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/Makefile
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/archives/fmt_44bsd
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_44bsd
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/Makefile.test b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test
index 5a8b065..5a8b065 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/Makefile.test
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/Makefile.test
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.status.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.status.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5
index 7b91643..7b91643 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6
index fd15190..fd15190 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7
index cb572e1..cb572e1 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stderr.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stderr.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/expected.stdout.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/expected.stdout.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh
index 2604c96..2604c96 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/legacy_test.sh
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/legacy_test.sh
diff --git a/usr.bin/make/tests/archives/fmt_44bsd/libtest.a b/usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a
index 891ce6e..891ce6e 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd/libtest.a
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd/libtest.a
Binary files differ
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile
index 8d63b64..1d2f6e2 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/archives/fmt_44bsd_mod
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_44bsd_mod
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile.test b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test
index cd999da..cd999da 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/Makefile.test
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/Makefile.test
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.status.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.status.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5
index 7b91643..7b91643 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6
index fd15190..fd15190 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7
index cb572e1..cb572e1 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stderr.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stderr.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.1
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.1
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.2
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.2
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.3
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.3
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.4
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.4
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.5
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.5
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.6
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.6
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/expected.stdout.7
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/expected.stdout.7
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh
index bf13f22..bf13f22 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/legacy_test.sh
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/legacy_test.sh
diff --git a/usr.bin/make/tests/archives/fmt_44bsd_mod/libtest.a b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a
index 57bc407..57bc407 100644
--- a/usr.bin/make/tests/archives/fmt_44bsd_mod/libtest.a
+++ b/usr.bin/bmake/tests/archives/fmt_44bsd_mod/libtest.a
Binary files differ
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/Makefile b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile
index ab1c383..2a96124 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/Makefile
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/archives/fmt_oldbsd
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/archives/fmt_oldbsd
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/Makefile.test b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test
index b8f5116..b8f5116 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/Makefile.test
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/Makefile.test
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.1
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.1
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.2
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.2
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.3
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.3
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.4
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.4
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5
index 573541a..573541a 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.5
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.5
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.6
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.6
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.status.7
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.status.7
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.1
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.1
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.2
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.2
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.3
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.3
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.4
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.4
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.5
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.5
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6
index fd15190..fd15190 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.6
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.6
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7
index cb572e1..cb572e1 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stderr.7
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stderr.7
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.1 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.1
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.1
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.2 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.2
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.2
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.3 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.3
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.3
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.4 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.4
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.4
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.5 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.5
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.5
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.6 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.6
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.6
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.7 b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/expected.stdout.7
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/expected.stdout.7
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/legacy_test.sh b/usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh
index c7980c5..c7980c5 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/legacy_test.sh
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/legacy_test.sh
diff --git a/usr.bin/make/tests/archives/fmt_oldbsd/libtest.a b/usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a
index 3434c53..3434c53 100644
--- a/usr.bin/make/tests/archives/fmt_oldbsd/libtest.a
+++ b/usr.bin/bmake/tests/archives/fmt_oldbsd/libtest.a
Binary files differ
diff --git a/usr.bin/make/tests/basic/Makefile b/usr.bin/bmake/tests/basic/Makefile
index fd7044e..56dfb33 100644
--- a/usr.bin/make/tests/basic/Makefile
+++ b/usr.bin/bmake/tests/basic/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/basic
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic
TESTS_SUBDIRS= t0 t1 t2 t3
diff --git a/usr.bin/make/tests/basic/t3/Makefile b/usr.bin/bmake/tests/basic/t0/Makefile
index 00c3757..1235659 100644
--- a/usr.bin/make/tests/basic/t3/Makefile
+++ b/usr.bin/bmake/tests/basic/t0/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/basic/t3
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t0
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/basic/t0/expected.status.1 b/usr.bin/bmake/tests/basic/t0/expected.status.1
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/basic/t0/expected.status.1
+++ b/usr.bin/bmake/tests/basic/t0/expected.status.1
diff --git a/usr.bin/make/tests/basic/t0/expected.stderr.1 b/usr.bin/bmake/tests/basic/t0/expected.stderr.1
index 90280c8..90280c8 100644
--- a/usr.bin/make/tests/basic/t0/expected.stderr.1
+++ b/usr.bin/bmake/tests/basic/t0/expected.stderr.1
diff --git a/usr.bin/make/tests/basic/t0/expected.stdout.1 b/usr.bin/bmake/tests/basic/t0/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/basic/t0/expected.stdout.1
+++ b/usr.bin/bmake/tests/basic/t0/expected.stdout.1
diff --git a/usr.bin/make/tests/basic/t0/legacy_test.sh b/usr.bin/bmake/tests/basic/t0/legacy_test.sh
index d23418a..d23418a 100644
--- a/usr.bin/make/tests/basic/t0/legacy_test.sh
+++ b/usr.bin/bmake/tests/basic/t0/legacy_test.sh
diff --git a/usr.bin/make/tests/basic/t2/Makefile b/usr.bin/bmake/tests/basic/t1/Makefile
index 4b598ea..732dc65 100644
--- a/usr.bin/make/tests/basic/t2/Makefile
+++ b/usr.bin/bmake/tests/basic/t1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/basic/t2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t1
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/basic/t1/Makefile.test b/usr.bin/bmake/tests/basic/t1/Makefile.test
index d120087..d120087 100644
--- a/usr.bin/make/tests/basic/t1/Makefile.test
+++ b/usr.bin/bmake/tests/basic/t1/Makefile.test
diff --git a/usr.bin/make/tests/basic/t1/expected.status.1 b/usr.bin/bmake/tests/basic/t1/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/basic/t1/expected.status.1
+++ b/usr.bin/bmake/tests/basic/t1/expected.status.1
diff --git a/usr.bin/make/tests/basic/t1/expected.stderr.1 b/usr.bin/bmake/tests/basic/t1/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/basic/t1/expected.stderr.1
+++ b/usr.bin/bmake/tests/basic/t1/expected.stderr.1
diff --git a/usr.bin/make/tests/basic/t1/expected.stdout.1 b/usr.bin/bmake/tests/basic/t1/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/basic/t1/expected.stdout.1
+++ b/usr.bin/bmake/tests/basic/t1/expected.stdout.1
diff --git a/usr.bin/make/tests/basic/t1/legacy_test.sh b/usr.bin/bmake/tests/basic/t1/legacy_test.sh
index b07f927..b07f927 100644
--- a/usr.bin/make/tests/basic/t1/legacy_test.sh
+++ b/usr.bin/bmake/tests/basic/t1/legacy_test.sh
diff --git a/usr.bin/make/tests/basic/t1/Makefile b/usr.bin/bmake/tests/basic/t2/Makefile
index efd9030..58c36ff 100644
--- a/usr.bin/make/tests/basic/t1/Makefile
+++ b/usr.bin/bmake/tests/basic/t2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/basic/t1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t2
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/basic/t2/Makefile.test b/usr.bin/bmake/tests/basic/t2/Makefile.test
index ab8fe49..ab8fe49 100644
--- a/usr.bin/make/tests/basic/t2/Makefile.test
+++ b/usr.bin/bmake/tests/basic/t2/Makefile.test
diff --git a/usr.bin/make/tests/basic/t2/expected.status.1 b/usr.bin/bmake/tests/basic/t2/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/basic/t2/expected.status.1
+++ b/usr.bin/bmake/tests/basic/t2/expected.status.1
diff --git a/usr.bin/make/tests/basic/t2/expected.stderr.1 b/usr.bin/bmake/tests/basic/t2/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/basic/t2/expected.stderr.1
+++ b/usr.bin/bmake/tests/basic/t2/expected.stderr.1
diff --git a/usr.bin/make/tests/basic/t2/expected.stdout.1 b/usr.bin/bmake/tests/basic/t2/expected.stdout.1
index e618540..e618540 100644
--- a/usr.bin/make/tests/basic/t2/expected.stdout.1
+++ b/usr.bin/bmake/tests/basic/t2/expected.stdout.1
diff --git a/usr.bin/make/tests/basic/t2/legacy_test.sh b/usr.bin/bmake/tests/basic/t2/legacy_test.sh
index da4c60a..da4c60a 100644
--- a/usr.bin/make/tests/basic/t2/legacy_test.sh
+++ b/usr.bin/bmake/tests/basic/t2/legacy_test.sh
diff --git a/usr.bin/make/tests/basic/t0/Makefile b/usr.bin/bmake/tests/basic/t3/Makefile
index ef390dd..a173414 100644
--- a/usr.bin/make/tests/basic/t0/Makefile
+++ b/usr.bin/bmake/tests/basic/t3/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/basic/t0
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/basic/t3
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/basic/t3/expected.status.1 b/usr.bin/bmake/tests/basic/t3/expected.status.1
index 0cfbf08..0cfbf08 100644
--- a/usr.bin/make/tests/basic/t3/expected.status.1
+++ b/usr.bin/bmake/tests/basic/t3/expected.status.1
diff --git a/usr.bin/make/tests/basic/t3/expected.stderr.1 b/usr.bin/bmake/tests/basic/t3/expected.stderr.1
index 90280c8..90280c8 100644
--- a/usr.bin/make/tests/basic/t3/expected.stderr.1
+++ b/usr.bin/bmake/tests/basic/t3/expected.stderr.1
diff --git a/usr.bin/make/tests/basic/t3/expected.stdout.1 b/usr.bin/bmake/tests/basic/t3/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/basic/t3/expected.stdout.1
+++ b/usr.bin/bmake/tests/basic/t3/expected.stdout.1
diff --git a/usr.bin/make/tests/basic/t3/legacy_test.sh b/usr.bin/bmake/tests/basic/t3/legacy_test.sh
index 3c41bb3..3c41bb3 100644
--- a/usr.bin/make/tests/basic/t3/legacy_test.sh
+++ b/usr.bin/bmake/tests/basic/t3/legacy_test.sh
diff --git a/usr.bin/make/tests/common.sh b/usr.bin/bmake/tests/common.sh
index 5c5df1e..5c5df1e 100644
--- a/usr.bin/make/tests/common.sh
+++ b/usr.bin/bmake/tests/common.sh
diff --git a/usr.bin/make/tests/execution/Makefile b/usr.bin/bmake/tests/execution/Makefile
index 52ba9b7..2c91bbb 100644
--- a/usr.bin/make/tests/execution/Makefile
+++ b/usr.bin/bmake/tests/execution/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/execution
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution
TESTS_SUBDIRS= ellipsis empty joberr plus
diff --git a/usr.bin/make/tests/execution/ellipsis/Makefile b/usr.bin/bmake/tests/execution/ellipsis/Makefile
index 7f3dc3e..5629b4b 100644
--- a/usr.bin/make/tests/execution/ellipsis/Makefile
+++ b/usr.bin/bmake/tests/execution/ellipsis/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/execution/ellipsis
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/ellipsis
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/execution/ellipsis/Makefile.test b/usr.bin/bmake/tests/execution/ellipsis/Makefile.test
index d19f642..d19f642 100644
--- a/usr.bin/make/tests/execution/ellipsis/Makefile.test
+++ b/usr.bin/bmake/tests/execution/ellipsis/Makefile.test
diff --git a/usr.bin/make/tests/execution/ellipsis/expected.status.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/execution/ellipsis/expected.status.1
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.status.1
diff --git a/usr.bin/make/tests/execution/ellipsis/expected.stderr.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/execution/ellipsis/expected.stderr.1
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.stderr.1
diff --git a/usr.bin/make/tests/execution/ellipsis/expected.stdout.1 b/usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1
index a7e5727..a7e5727 100644
--- a/usr.bin/make/tests/execution/ellipsis/expected.stdout.1
+++ b/usr.bin/bmake/tests/execution/ellipsis/expected.stdout.1
diff --git a/usr.bin/make/tests/execution/ellipsis/legacy_test.sh b/usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh
index 9e9cd01..9e9cd01 100644
--- a/usr.bin/make/tests/execution/ellipsis/legacy_test.sh
+++ b/usr.bin/bmake/tests/execution/ellipsis/legacy_test.sh
diff --git a/usr.bin/make/tests/execution/joberr/Makefile b/usr.bin/bmake/tests/execution/empty/Makefile
index eb77957..6421b96 100644
--- a/usr.bin/make/tests/execution/joberr/Makefile
+++ b/usr.bin/bmake/tests/execution/empty/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/execution/joberr
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/empty
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/execution/empty/Makefile.test b/usr.bin/bmake/tests/execution/empty/Makefile.test
index f687bce..f687bce 100644
--- a/usr.bin/make/tests/execution/empty/Makefile.test
+++ b/usr.bin/bmake/tests/execution/empty/Makefile.test
diff --git a/usr.bin/make/tests/execution/empty/expected.status.1 b/usr.bin/bmake/tests/execution/empty/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/execution/empty/expected.status.1
+++ b/usr.bin/bmake/tests/execution/empty/expected.status.1
diff --git a/usr.bin/make/tests/execution/empty/expected.stderr.1 b/usr.bin/bmake/tests/execution/empty/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/execution/empty/expected.stderr.1
+++ b/usr.bin/bmake/tests/execution/empty/expected.stderr.1
diff --git a/usr.bin/make/tests/execution/empty/expected.stdout.1 b/usr.bin/bmake/tests/execution/empty/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/execution/empty/expected.stdout.1
+++ b/usr.bin/bmake/tests/execution/empty/expected.stdout.1
diff --git a/usr.bin/make/tests/execution/empty/legacy_test.sh b/usr.bin/bmake/tests/execution/empty/legacy_test.sh
index e02d175..e02d175 100644
--- a/usr.bin/make/tests/execution/empty/legacy_test.sh
+++ b/usr.bin/bmake/tests/execution/empty/legacy_test.sh
diff --git a/usr.bin/make/tests/execution/empty/Makefile b/usr.bin/bmake/tests/execution/joberr/Makefile
index 31c2714..d183eb1 100644
--- a/usr.bin/make/tests/execution/empty/Makefile
+++ b/usr.bin/bmake/tests/execution/joberr/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/execution/empty
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/joberr
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/execution/joberr/Makefile.test b/usr.bin/bmake/tests/execution/joberr/Makefile.test
index aca86e8..aca86e8 100644
--- a/usr.bin/make/tests/execution/joberr/Makefile.test
+++ b/usr.bin/bmake/tests/execution/joberr/Makefile.test
diff --git a/usr.bin/make/tests/execution/joberr/expected.status.1 b/usr.bin/bmake/tests/execution/joberr/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/execution/joberr/expected.status.1
+++ b/usr.bin/bmake/tests/execution/joberr/expected.status.1
diff --git a/usr.bin/make/tests/execution/joberr/expected.stderr.1 b/usr.bin/bmake/tests/execution/joberr/expected.stderr.1
index d0c8a2e..d0c8a2e 100644
--- a/usr.bin/make/tests/execution/joberr/expected.stderr.1
+++ b/usr.bin/bmake/tests/execution/joberr/expected.stderr.1
diff --git a/usr.bin/make/tests/execution/joberr/expected.stdout.1 b/usr.bin/bmake/tests/execution/joberr/expected.stdout.1
index 0ee28f4..0ee28f4 100644
--- a/usr.bin/make/tests/execution/joberr/expected.stdout.1
+++ b/usr.bin/bmake/tests/execution/joberr/expected.stdout.1
diff --git a/usr.bin/make/tests/execution/joberr/legacy_test.sh b/usr.bin/bmake/tests/execution/joberr/legacy_test.sh
index 429bfe1..429bfe1 100644
--- a/usr.bin/make/tests/execution/joberr/legacy_test.sh
+++ b/usr.bin/bmake/tests/execution/joberr/legacy_test.sh
diff --git a/usr.bin/make/tests/execution/plus/Makefile b/usr.bin/bmake/tests/execution/plus/Makefile
index 2dea979..8b489d5 100644
--- a/usr.bin/make/tests/execution/plus/Makefile
+++ b/usr.bin/bmake/tests/execution/plus/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/execution/plus
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/execution/plus
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/execution/plus/Makefile.test b/usr.bin/bmake/tests/execution/plus/Makefile.test
index ae3bdc3..ae3bdc3 100644
--- a/usr.bin/make/tests/execution/plus/Makefile.test
+++ b/usr.bin/bmake/tests/execution/plus/Makefile.test
diff --git a/usr.bin/make/tests/execution/plus/expected.status.1 b/usr.bin/bmake/tests/execution/plus/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/execution/plus/expected.status.1
+++ b/usr.bin/bmake/tests/execution/plus/expected.status.1
diff --git a/usr.bin/make/tests/execution/plus/expected.stderr.1 b/usr.bin/bmake/tests/execution/plus/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/execution/plus/expected.stderr.1
+++ b/usr.bin/bmake/tests/execution/plus/expected.stderr.1
diff --git a/usr.bin/make/tests/execution/plus/expected.stdout.1 b/usr.bin/bmake/tests/execution/plus/expected.stdout.1
index b334fc7..b334fc7 100644
--- a/usr.bin/make/tests/execution/plus/expected.stdout.1
+++ b/usr.bin/bmake/tests/execution/plus/expected.stdout.1
diff --git a/usr.bin/make/tests/execution/plus/legacy_test.sh b/usr.bin/bmake/tests/execution/plus/legacy_test.sh
index 0737d1b..0737d1b 100644
--- a/usr.bin/make/tests/execution/plus/legacy_test.sh
+++ b/usr.bin/bmake/tests/execution/plus/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/Makefile b/usr.bin/bmake/tests/shell/Makefile
index cde8335..13b570e 100644
--- a/usr.bin/make/tests/shell/Makefile
+++ b/usr.bin/bmake/tests/shell/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell
TESTS_SUBDIRS= builtin meta path path_select replace select
diff --git a/usr.bin/make/tests/shell/builtin/Makefile b/usr.bin/bmake/tests/shell/builtin/Makefile
index 3a73215..cd458a9 100644
--- a/usr.bin/make/tests/shell/builtin/Makefile
+++ b/usr.bin/bmake/tests/shell/builtin/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/builtin
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/builtin
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/builtin/Makefile.test b/usr.bin/bmake/tests/shell/builtin/Makefile.test
index 0376478..0376478 100644
--- a/usr.bin/make/tests/shell/builtin/Makefile.test
+++ b/usr.bin/bmake/tests/shell/builtin/Makefile.test
diff --git a/usr.bin/make/tests/shell/builtin/expected.status.1 b/usr.bin/bmake/tests/shell/builtin/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/builtin/expected.status.1
+++ b/usr.bin/bmake/tests/shell/builtin/expected.status.1
diff --git a/usr.bin/make/tests/shell/builtin/expected.status.2 b/usr.bin/bmake/tests/shell/builtin/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/builtin/expected.status.2
+++ b/usr.bin/bmake/tests/shell/builtin/expected.status.2
diff --git a/usr.bin/make/tests/shell/builtin/expected.stderr.1 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/builtin/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/builtin/expected.stderr.2 b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/builtin/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/builtin/expected.stdout.1 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1
index 9c558e3..9c558e3 100644
--- a/usr.bin/make/tests/shell/builtin/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/builtin/expected.stdout.2 b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2
index e350eaf..e350eaf 100644
--- a/usr.bin/make/tests/shell/builtin/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/builtin/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/builtin/legacy_test.sh b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh
index 6347583..6347583 100644
--- a/usr.bin/make/tests/shell/builtin/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/builtin/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/builtin/sh b/usr.bin/bmake/tests/shell/builtin/sh
index 3a507b87..3a507b87 100644
--- a/usr.bin/make/tests/shell/builtin/sh
+++ b/usr.bin/bmake/tests/shell/builtin/sh
diff --git a/usr.bin/make/tests/shell/meta/Makefile b/usr.bin/bmake/tests/shell/meta/Makefile
index ebd2177..b342e79 100644
--- a/usr.bin/make/tests/shell/meta/Makefile
+++ b/usr.bin/bmake/tests/shell/meta/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/meta
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/meta
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/meta/Makefile.test b/usr.bin/bmake/tests/shell/meta/Makefile.test
index bcf19d0..bcf19d0 100644
--- a/usr.bin/make/tests/shell/meta/Makefile.test
+++ b/usr.bin/bmake/tests/shell/meta/Makefile.test
diff --git a/usr.bin/make/tests/shell/meta/expected.status.1 b/usr.bin/bmake/tests/shell/meta/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/meta/expected.status.1
+++ b/usr.bin/bmake/tests/shell/meta/expected.status.1
diff --git a/usr.bin/make/tests/shell/meta/expected.status.2 b/usr.bin/bmake/tests/shell/meta/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/meta/expected.status.2
+++ b/usr.bin/bmake/tests/shell/meta/expected.status.2
diff --git a/usr.bin/make/tests/shell/meta/expected.stderr.1 b/usr.bin/bmake/tests/shell/meta/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/meta/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/meta/expected.stderr.2 b/usr.bin/bmake/tests/shell/meta/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/meta/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/meta/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/meta/expected.stdout.1 b/usr.bin/bmake/tests/shell/meta/expected.stdout.1
index 9c558e3..9c558e3 100644
--- a/usr.bin/make/tests/shell/meta/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/meta/expected.stdout.2 b/usr.bin/bmake/tests/shell/meta/expected.stdout.2
index 6ac6f19..6ac6f19 100644
--- a/usr.bin/make/tests/shell/meta/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/meta/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/meta/legacy_test.sh b/usr.bin/bmake/tests/shell/meta/legacy_test.sh
index 41cd763..41cd763 100644
--- a/usr.bin/make/tests/shell/meta/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/meta/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/meta/sh b/usr.bin/bmake/tests/shell/meta/sh
index 3a507b87..3a507b87 100644
--- a/usr.bin/make/tests/shell/meta/sh
+++ b/usr.bin/bmake/tests/shell/meta/sh
diff --git a/usr.bin/make/tests/shell/path/Makefile b/usr.bin/bmake/tests/shell/path/Makefile
index d1eb37a..5a83a1f 100644
--- a/usr.bin/make/tests/shell/path/Makefile
+++ b/usr.bin/bmake/tests/shell/path/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/path
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/path/Makefile.test b/usr.bin/bmake/tests/shell/path/Makefile.test
index fe40b64..fe40b64 100644
--- a/usr.bin/make/tests/shell/path/Makefile.test
+++ b/usr.bin/bmake/tests/shell/path/Makefile.test
diff --git a/usr.bin/make/tests/shell/path/expected.status.1 b/usr.bin/bmake/tests/shell/path/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/path/expected.status.1
+++ b/usr.bin/bmake/tests/shell/path/expected.status.1
diff --git a/usr.bin/make/tests/shell/path/expected.status.2 b/usr.bin/bmake/tests/shell/path/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/path/expected.status.2
+++ b/usr.bin/bmake/tests/shell/path/expected.status.2
diff --git a/usr.bin/make/tests/shell/path/expected.stderr.1 b/usr.bin/bmake/tests/shell/path/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/path/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/path/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/path/expected.stderr.2 b/usr.bin/bmake/tests/shell/path/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/path/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/path/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/path/expected.stdout.1 b/usr.bin/bmake/tests/shell/path/expected.stdout.1
index d881364..d881364 100644
--- a/usr.bin/make/tests/shell/path/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/path/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/path/expected.stdout.2 b/usr.bin/bmake/tests/shell/path/expected.stdout.2
index de3fc89..de3fc89 100644
--- a/usr.bin/make/tests/shell/path/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/path/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/path/legacy_test.sh b/usr.bin/bmake/tests/shell/path/legacy_test.sh
index 9289a8d..9289a8d 100644
--- a/usr.bin/make/tests/shell/path/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/path/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/path/sh b/usr.bin/bmake/tests/shell/path/sh
index 46169eb..46169eb 100644
--- a/usr.bin/make/tests/shell/path/sh
+++ b/usr.bin/bmake/tests/shell/path/sh
diff --git a/usr.bin/make/tests/shell/path_select/Makefile b/usr.bin/bmake/tests/shell/path_select/Makefile
index d9341b4..1819f91 100644
--- a/usr.bin/make/tests/shell/path_select/Makefile
+++ b/usr.bin/bmake/tests/shell/path_select/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/path_select
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/path_select
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/path_select/Makefile.test b/usr.bin/bmake/tests/shell/path_select/Makefile.test
index 05cfb27..05cfb27 100644
--- a/usr.bin/make/tests/shell/path_select/Makefile.test
+++ b/usr.bin/bmake/tests/shell/path_select/Makefile.test
diff --git a/usr.bin/make/tests/shell/path_select/expected.status.1 b/usr.bin/bmake/tests/shell/path_select/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/path_select/expected.status.1
+++ b/usr.bin/bmake/tests/shell/path_select/expected.status.1
diff --git a/usr.bin/make/tests/shell/path_select/expected.status.2 b/usr.bin/bmake/tests/shell/path_select/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/path_select/expected.status.2
+++ b/usr.bin/bmake/tests/shell/path_select/expected.status.2
diff --git a/usr.bin/make/tests/shell/path_select/expected.stderr.1 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/path_select/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/path_select/expected.stderr.2 b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/path_select/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/path_select/expected.stdout.1 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1
index d881364..d881364 100644
--- a/usr.bin/make/tests/shell/path_select/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/path_select/expected.stdout.2 b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2
index de3fc89..de3fc89 100644
--- a/usr.bin/make/tests/shell/path_select/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/path_select/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/path_select/legacy_test.sh b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh
index 6b75b90..6b75b90 100644
--- a/usr.bin/make/tests/shell/path_select/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/path_select/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/path_select/shell b/usr.bin/bmake/tests/shell/path_select/shell
index 46169eb..46169eb 100644
--- a/usr.bin/make/tests/shell/path_select/shell
+++ b/usr.bin/bmake/tests/shell/path_select/shell
diff --git a/usr.bin/make/tests/shell/replace/Makefile b/usr.bin/bmake/tests/shell/replace/Makefile
index 7c64d72..0dae915 100644
--- a/usr.bin/make/tests/shell/replace/Makefile
+++ b/usr.bin/bmake/tests/shell/replace/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/replace
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/replace
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/replace/Makefile.test b/usr.bin/bmake/tests/shell/replace/Makefile.test
index 2160dbf..2160dbf 100644
--- a/usr.bin/make/tests/shell/replace/Makefile.test
+++ b/usr.bin/bmake/tests/shell/replace/Makefile.test
diff --git a/usr.bin/make/tests/shell/replace/expected.status.1 b/usr.bin/bmake/tests/shell/replace/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/replace/expected.status.1
+++ b/usr.bin/bmake/tests/shell/replace/expected.status.1
diff --git a/usr.bin/make/tests/shell/replace/expected.status.2 b/usr.bin/bmake/tests/shell/replace/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/replace/expected.status.2
+++ b/usr.bin/bmake/tests/shell/replace/expected.status.2
diff --git a/usr.bin/make/tests/shell/replace/expected.stderr.1 b/usr.bin/bmake/tests/shell/replace/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/replace/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/replace/expected.stderr.2 b/usr.bin/bmake/tests/shell/replace/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/replace/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/replace/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/replace/expected.stdout.1 b/usr.bin/bmake/tests/shell/replace/expected.stdout.1
index eff99ea..eff99ea 100644
--- a/usr.bin/make/tests/shell/replace/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/replace/expected.stdout.2 b/usr.bin/bmake/tests/shell/replace/expected.stdout.2
index c79a09a..c79a09a 100644
--- a/usr.bin/make/tests/shell/replace/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/replace/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/replace/legacy_test.sh b/usr.bin/bmake/tests/shell/replace/legacy_test.sh
index 880ca78..880ca78 100644
--- a/usr.bin/make/tests/shell/replace/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/replace/legacy_test.sh
diff --git a/usr.bin/make/tests/shell/replace/shell b/usr.bin/bmake/tests/shell/replace/shell
index 46169eb..46169eb 100644
--- a/usr.bin/make/tests/shell/replace/shell
+++ b/usr.bin/bmake/tests/shell/replace/shell
diff --git a/usr.bin/make/tests/shell/select/Makefile b/usr.bin/bmake/tests/shell/select/Makefile
index 85486c6..45e6d72 100644
--- a/usr.bin/make/tests/shell/select/Makefile
+++ b/usr.bin/bmake/tests/shell/select/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/shell/select
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/shell/select
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/shell/select/Makefile.test b/usr.bin/bmake/tests/shell/select/Makefile.test
index 74d96e1..74d96e1 100644
--- a/usr.bin/make/tests/shell/select/Makefile.test
+++ b/usr.bin/bmake/tests/shell/select/Makefile.test
diff --git a/usr.bin/make/tests/shell/select/expected.status.1 b/usr.bin/bmake/tests/shell/select/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/select/expected.status.1
+++ b/usr.bin/bmake/tests/shell/select/expected.status.1
diff --git a/usr.bin/make/tests/shell/select/expected.status.2 b/usr.bin/bmake/tests/shell/select/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/shell/select/expected.status.2
+++ b/usr.bin/bmake/tests/shell/select/expected.status.2
diff --git a/usr.bin/make/tests/shell/select/expected.stderr.1 b/usr.bin/bmake/tests/shell/select/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/select/expected.stderr.1
+++ b/usr.bin/bmake/tests/shell/select/expected.stderr.1
diff --git a/usr.bin/make/tests/shell/select/expected.stderr.2 b/usr.bin/bmake/tests/shell/select/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/shell/select/expected.stderr.2
+++ b/usr.bin/bmake/tests/shell/select/expected.stderr.2
diff --git a/usr.bin/make/tests/shell/select/expected.stdout.1 b/usr.bin/bmake/tests/shell/select/expected.stdout.1
index c2cdaa0..c2cdaa0 100644
--- a/usr.bin/make/tests/shell/select/expected.stdout.1
+++ b/usr.bin/bmake/tests/shell/select/expected.stdout.1
diff --git a/usr.bin/make/tests/shell/select/expected.stdout.2 b/usr.bin/bmake/tests/shell/select/expected.stdout.2
index 5a831e8..5a831e8 100644
--- a/usr.bin/make/tests/shell/select/expected.stdout.2
+++ b/usr.bin/bmake/tests/shell/select/expected.stdout.2
diff --git a/usr.bin/make/tests/shell/select/legacy_test.sh b/usr.bin/bmake/tests/shell/select/legacy_test.sh
index 46d3eaf..46d3eaf 100644
--- a/usr.bin/make/tests/shell/select/legacy_test.sh
+++ b/usr.bin/bmake/tests/shell/select/legacy_test.sh
diff --git a/usr.bin/make/tests/suffixes/Makefile b/usr.bin/bmake/tests/suffixes/Makefile
index f15620d..60ec86e 100644
--- a/usr.bin/make/tests/suffixes/Makefile
+++ b/usr.bin/bmake/tests/suffixes/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/suffixes
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes
TESTS_SUBDIRS= basic src_wild1 src_wild2
diff --git a/usr.bin/make/tests/suffixes/basic/Makefile b/usr.bin/bmake/tests/suffixes/basic/Makefile
index 2bd3a78..9ae720e 100644
--- a/usr.bin/make/tests/suffixes/basic/Makefile
+++ b/usr.bin/bmake/tests/suffixes/basic/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/suffixes/basic
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/basic
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/suffixes/basic/Makefile.test b/usr.bin/bmake/tests/suffixes/basic/Makefile.test
index 45d9130..45d9130 100644
--- a/usr.bin/make/tests/suffixes/basic/Makefile.test
+++ b/usr.bin/bmake/tests/suffixes/basic/Makefile.test
diff --git a/usr.bin/make/tests/suffixes/basic/TEST1.a b/usr.bin/bmake/tests/suffixes/basic/TEST1.a
index da5569b..da5569b 100644
--- a/usr.bin/make/tests/suffixes/basic/TEST1.a
+++ b/usr.bin/bmake/tests/suffixes/basic/TEST1.a
diff --git a/usr.bin/make/tests/suffixes/basic/expected.status.1 b/usr.bin/bmake/tests/suffixes/basic/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/suffixes/basic/expected.status.1
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.status.1
diff --git a/usr.bin/make/tests/suffixes/basic/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/basic/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/suffixes/basic/expected.stderr.1
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.stderr.1
diff --git a/usr.bin/make/tests/suffixes/basic/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/basic/expected.stdout.1
index 582927e..582927e 100644
--- a/usr.bin/make/tests/suffixes/basic/expected.stdout.1
+++ b/usr.bin/bmake/tests/suffixes/basic/expected.stdout.1
diff --git a/usr.bin/make/tests/suffixes/basic/legacy_test.sh b/usr.bin/bmake/tests/suffixes/basic/legacy_test.sh
index 3446bf0..3446bf0 100644
--- a/usr.bin/make/tests/suffixes/basic/legacy_test.sh
+++ b/usr.bin/bmake/tests/suffixes/basic/legacy_test.sh
diff --git a/usr.bin/make/tests/suffixes/src_wild1/Makefile b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile
index e10e8e8..00be930 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/Makefile
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/suffixes/src_wild1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/src_wild1
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/suffixes/src_wild1/Makefile.test b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test
index d0258ad..d0258ad 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/Makefile.test
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/Makefile.test
diff --git a/usr.bin/make/tests/suffixes/src_wild1/TEST1.a b/usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a
index da5569b..da5569b 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/TEST1.a
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/TEST1.a
diff --git a/usr.bin/make/tests/suffixes/src_wild1/TEST2.a b/usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a
index 34f8508..34f8508 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/TEST2.a
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/TEST2.a
diff --git a/usr.bin/make/tests/suffixes/src_wild1/expected.status.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/expected.status.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.status.1
diff --git a/usr.bin/make/tests/suffixes/src_wild1/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/expected.stderr.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stderr.1
diff --git a/usr.bin/make/tests/suffixes/src_wild1/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1
index 3cd2129..3cd2129 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/expected.stdout.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/expected.stdout.1
diff --git a/usr.bin/make/tests/suffixes/src_wild1/legacy_test.sh b/usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh
index 053cc6c..053cc6c 100644
--- a/usr.bin/make/tests/suffixes/src_wild1/legacy_test.sh
+++ b/usr.bin/bmake/tests/suffixes/src_wild1/legacy_test.sh
diff --git a/usr.bin/make/tests/suffixes/src_wild2/Makefile b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile
index a474bae..34aad07 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/Makefile
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/suffixes/src_wild2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/suffixes/src_wild2
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/suffixes/src_wild2/Makefile.test b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test
index 1dea7ea..1dea7ea 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/Makefile.test
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/Makefile.test
diff --git a/usr.bin/make/tests/suffixes/src_wild2/TEST1.a b/usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a
index da5569b..da5569b 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/TEST1.a
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/TEST1.a
diff --git a/usr.bin/make/tests/suffixes/src_wild2/TEST2.a b/usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a
index 34f8508..34f8508 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/TEST2.a
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/TEST2.a
diff --git a/usr.bin/make/tests/suffixes/src_wild2/expected.status.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/expected.status.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.status.1
diff --git a/usr.bin/make/tests/suffixes/src_wild2/expected.stderr.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/expected.stderr.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stderr.1
diff --git a/usr.bin/make/tests/suffixes/src_wild2/expected.stdout.1 b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1
index 3cd2129..3cd2129 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/expected.stdout.1
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/expected.stdout.1
diff --git a/usr.bin/make/tests/suffixes/src_wild2/legacy_test.sh b/usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh
index 03cff93..03cff93 100644
--- a/usr.bin/make/tests/suffixes/src_wild2/legacy_test.sh
+++ b/usr.bin/bmake/tests/suffixes/src_wild2/legacy_test.sh
diff --git a/usr.bin/make/tests/syntax/Makefile b/usr.bin/bmake/tests/syntax/Makefile
index 80f1846..3cd89f8 100644
--- a/usr.bin/make/tests/syntax/Makefile
+++ b/usr.bin/bmake/tests/syntax/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/syntax
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax
TESTS_SUBDIRS= directive-t0 enl funny-targets semi
diff --git a/usr.bin/bmake/tests/syntax/directive-t0/Makefile b/usr.bin/bmake/tests/syntax/directive-t0/Makefile
new file mode 100644
index 0000000..66e1f32
--- /dev/null
+++ b/usr.bin/bmake/tests/syntax/directive-t0/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/directive-t0
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= Makefile.test
+FILES+= expected.status.1
+FILES+= expected.stderr.1
+FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/make/tests/syntax/directive-t0/Makefile.test b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.test
index 0f95a21..0f95a21 100644
--- a/usr.bin/make/tests/syntax/directive-t0/Makefile.test
+++ b/usr.bin/bmake/tests/syntax/directive-t0/Makefile.test
diff --git a/usr.bin/make/tests/syntax/directive-t0/expected.status.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.status.1
index d00491f..d00491f 100644
--- a/usr.bin/make/tests/syntax/directive-t0/expected.status.1
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.status.1
diff --git a/usr.bin/make/tests/syntax/directive-t0/expected.stderr.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1
index de66fcc..de66fcc 100644
--- a/usr.bin/make/tests/syntax/directive-t0/expected.stderr.1
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.stderr.1
diff --git a/usr.bin/make/tests/syntax/directive-t0/expected.stdout.1 b/usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/directive-t0/expected.stdout.1
+++ b/usr.bin/bmake/tests/syntax/directive-t0/expected.stdout.1
diff --git a/usr.bin/make/tests/syntax/directive-t0/legacy_test.sh b/usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh
index 451c876..451c876 100644
--- a/usr.bin/make/tests/syntax/directive-t0/legacy_test.sh
+++ b/usr.bin/bmake/tests/syntax/directive-t0/legacy_test.sh
diff --git a/usr.bin/make/tests/syntax/enl/Makefile b/usr.bin/bmake/tests/syntax/enl/Makefile
index 362962c..743e88f 100644
--- a/usr.bin/make/tests/syntax/enl/Makefile
+++ b/usr.bin/bmake/tests/syntax/enl/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/syntax/enl
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/enl
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/syntax/enl/Makefile.test b/usr.bin/bmake/tests/syntax/enl/Makefile.test
index a7c6955..a7c6955 100644
--- a/usr.bin/make/tests/syntax/enl/Makefile.test
+++ b/usr.bin/bmake/tests/syntax/enl/Makefile.test
diff --git a/usr.bin/make/tests/syntax/enl/expected.status.1 b/usr.bin/bmake/tests/syntax/enl/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/enl/expected.status.1
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.1
diff --git a/usr.bin/make/tests/syntax/enl/expected.status.2 b/usr.bin/bmake/tests/syntax/enl/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/enl/expected.status.2
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.2
diff --git a/usr.bin/make/tests/syntax/enl/expected.status.3 b/usr.bin/bmake/tests/syntax/enl/expected.status.3
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/enl/expected.status.3
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.3
diff --git a/usr.bin/make/tests/syntax/enl/expected.status.4 b/usr.bin/bmake/tests/syntax/enl/expected.status.4
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/enl/expected.status.4
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.4
diff --git a/usr.bin/make/tests/syntax/enl/expected.status.5 b/usr.bin/bmake/tests/syntax/enl/expected.status.5
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/enl/expected.status.5
+++ b/usr.bin/bmake/tests/syntax/enl/expected.status.5
diff --git a/usr.bin/make/tests/syntax/enl/expected.stderr.1 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stderr.1
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.1
diff --git a/usr.bin/make/tests/syntax/enl/expected.stderr.2 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stderr.2
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.2
diff --git a/usr.bin/make/tests/syntax/enl/expected.stderr.3 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stderr.3
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.3
diff --git a/usr.bin/make/tests/syntax/enl/expected.stderr.4 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.4
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stderr.4
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.4
diff --git a/usr.bin/make/tests/syntax/enl/expected.stderr.5 b/usr.bin/bmake/tests/syntax/enl/expected.stderr.5
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stderr.5
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stderr.5
diff --git a/usr.bin/make/tests/syntax/enl/expected.stdout.1 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.1
index 9766475..9766475 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stdout.1
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.1
diff --git a/usr.bin/make/tests/syntax/enl/expected.stdout.2 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.2
index 9766475..9766475 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stdout.2
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.2
diff --git a/usr.bin/make/tests/syntax/enl/expected.stdout.3 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.3
index 422c2b7..422c2b7 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stdout.3
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.3
diff --git a/usr.bin/make/tests/syntax/enl/expected.stdout.4 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.4
index b2901ea..b2901ea 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stdout.4
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.4
diff --git a/usr.bin/make/tests/syntax/enl/expected.stdout.5 b/usr.bin/bmake/tests/syntax/enl/expected.stdout.5
index 5120076..5120076 100644
--- a/usr.bin/make/tests/syntax/enl/expected.stdout.5
+++ b/usr.bin/bmake/tests/syntax/enl/expected.stdout.5
diff --git a/usr.bin/make/tests/syntax/enl/legacy_test.sh b/usr.bin/bmake/tests/syntax/enl/legacy_test.sh
index 307c1f0..307c1f0 100644
--- a/usr.bin/make/tests/syntax/enl/legacy_test.sh
+++ b/usr.bin/bmake/tests/syntax/enl/legacy_test.sh
diff --git a/usr.bin/make/tests/syntax/funny-targets/Makefile b/usr.bin/bmake/tests/syntax/funny-targets/Makefile
index 07b1f75..53a3e4d 100644
--- a/usr.bin/make/tests/syntax/funny-targets/Makefile
+++ b/usr.bin/bmake/tests/syntax/funny-targets/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/syntax/funny-targets
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/funny-targets
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/syntax/funny-targets/Makefile.test b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.test
index 064ab3a..064ab3a 100644
--- a/usr.bin/make/tests/syntax/funny-targets/Makefile.test
+++ b/usr.bin/bmake/tests/syntax/funny-targets/Makefile.test
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.status.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.status.1
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.1
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.status.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.status.2
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.status.2
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.stderr.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.stderr.1
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.1
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.stderr.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.stderr.2
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stderr.2
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.stdout.1 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1
index 09cb232..09cb232 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.stdout.1
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.1
diff --git a/usr.bin/make/tests/syntax/funny-targets/expected.stdout.2 b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2
index b2f0364..b2f0364 100644
--- a/usr.bin/make/tests/syntax/funny-targets/expected.stdout.2
+++ b/usr.bin/bmake/tests/syntax/funny-targets/expected.stdout.2
diff --git a/usr.bin/make/tests/syntax/funny-targets/legacy_test.sh b/usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh
index e9cd317..e9cd317 100644
--- a/usr.bin/make/tests/syntax/funny-targets/legacy_test.sh
+++ b/usr.bin/bmake/tests/syntax/funny-targets/legacy_test.sh
diff --git a/usr.bin/make/tests/syntax/semi/Makefile b/usr.bin/bmake/tests/syntax/semi/Makefile
index 703683d..00a7f1e 100644
--- a/usr.bin/make/tests/syntax/semi/Makefile
+++ b/usr.bin/bmake/tests/syntax/semi/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/syntax/semi
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/syntax/semi
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/syntax/semi/Makefile.test b/usr.bin/bmake/tests/syntax/semi/Makefile.test
index 12f5225..12f5225 100644
--- a/usr.bin/make/tests/syntax/semi/Makefile.test
+++ b/usr.bin/bmake/tests/syntax/semi/Makefile.test
diff --git a/usr.bin/make/tests/syntax/semi/expected.status.1 b/usr.bin/bmake/tests/syntax/semi/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/semi/expected.status.1
+++ b/usr.bin/bmake/tests/syntax/semi/expected.status.1
diff --git a/usr.bin/make/tests/syntax/semi/expected.status.2 b/usr.bin/bmake/tests/syntax/semi/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/syntax/semi/expected.status.2
+++ b/usr.bin/bmake/tests/syntax/semi/expected.status.2
diff --git a/usr.bin/make/tests/syntax/semi/expected.stderr.1 b/usr.bin/bmake/tests/syntax/semi/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/semi/expected.stderr.1
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stderr.1
diff --git a/usr.bin/make/tests/syntax/semi/expected.stderr.2 b/usr.bin/bmake/tests/syntax/semi/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/syntax/semi/expected.stderr.2
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stderr.2
diff --git a/usr.bin/make/tests/syntax/semi/expected.stdout.1 b/usr.bin/bmake/tests/syntax/semi/expected.stdout.1
index 12b9617..12b9617 100644
--- a/usr.bin/make/tests/syntax/semi/expected.stdout.1
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stdout.1
diff --git a/usr.bin/make/tests/syntax/semi/expected.stdout.2 b/usr.bin/bmake/tests/syntax/semi/expected.stdout.2
index be0fa55..be0fa55 100644
--- a/usr.bin/make/tests/syntax/semi/expected.stdout.2
+++ b/usr.bin/bmake/tests/syntax/semi/expected.stdout.2
diff --git a/usr.bin/make/tests/syntax/semi/legacy_test.sh b/usr.bin/bmake/tests/syntax/semi/legacy_test.sh
index 092635a..092635a 100644
--- a/usr.bin/make/tests/syntax/semi/legacy_test.sh
+++ b/usr.bin/bmake/tests/syntax/semi/legacy_test.sh
diff --git a/usr.bin/make/tests/sysmk/Makefile b/usr.bin/bmake/tests/sysmk/Makefile
index 7b7b981..90d90f1 100644
--- a/usr.bin/make/tests/sysmk/Makefile
+++ b/usr.bin/bmake/tests/sysmk/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk
TESTS_SUBDIRS= t0 t1 t2
diff --git a/usr.bin/make/tests/variables/t0/Makefile b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile
index 06e1179..5578a9b 100644
--- a/usr.bin/make/tests/variables/t0/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/variables/t0
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/2/1
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/Makefile.test b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test
index fc95f46..fc95f46 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/Makefile.test
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/Makefile.test
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/expected.status.1
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.status.1
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/expected.stderr.1
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stderr.1
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1
index 6f29307..6f29307 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/expected.stdout.1
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/expected.stdout.1
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh
index 0214842..0214842 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/legacy_test.sh
+++ b/usr.bin/bmake/tests/sysmk/t0/2/1/legacy_test.sh
diff --git a/usr.bin/make/tests/sysmk/t2/2/Makefile b/usr.bin/bmake/tests/sysmk/t0/2/Makefile
index 3dd84f0..2204807 100644
--- a/usr.bin/make/tests/sysmk/t2/2/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t0/2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t2/2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/2
TESTS_SUBDIRS= 1
diff --git a/usr.bin/make/tests/sysmk/t1/Makefile b/usr.bin/bmake/tests/sysmk/t0/Makefile
index d8a2c06..f38383c 100644
--- a/usr.bin/make/tests/sysmk/t1/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t0/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0
TESTS_SUBDIRS= 2
SUBDIR= mk
diff --git a/usr.bin/make/tests/sysmk/t0/mk/Makefile b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile
index 047b9de..be1bd5a 100644
--- a/usr.bin/make/tests/sysmk/t0/mk/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t0/mk/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t0/mk
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t0/mk
FILESDIR= ${TESTSDIR}
FILES= sys.mk.test
diff --git a/usr.bin/make/tests/sysmk/t0/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test
index 60f1955..60f1955 100644
--- a/usr.bin/make/tests/sysmk/t0/mk/sys.mk.test
+++ b/usr.bin/bmake/tests/sysmk/t0/mk/sys.mk.test
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/Makefile b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile
index aa93766..c5e2889 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t1/2/1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/2/1
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/cleanup b/usr.bin/bmake/tests/sysmk/t1/2/1/cleanup
index c3d58b7..c3d58b7 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/cleanup
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/cleanup
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/expected.status.1
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.status.1
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/expected.stderr.1
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stderr.1
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1
index 6f29307..6f29307 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/expected.stdout.1
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/expected.stdout.1
diff --git a/usr.bin/make/tests/sysmk/t1/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh
index fb73851..fb73851 100644
--- a/usr.bin/make/tests/sysmk/t1/2/1/legacy_test.sh
+++ b/usr.bin/bmake/tests/sysmk/t1/2/1/legacy_test.sh
diff --git a/usr.bin/make/tests/sysmk/t0/2/Makefile b/usr.bin/bmake/tests/sysmk/t1/2/Makefile
index ecd79b3..7c2e619 100644
--- a/usr.bin/make/tests/sysmk/t0/2/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t1/2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t0/2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/2
TESTS_SUBDIRS= 1
diff --git a/usr.bin/make/tests/sysmk/t2/Makefile b/usr.bin/bmake/tests/sysmk/t1/Makefile
index 3f95a85..4d32823 100644
--- a/usr.bin/make/tests/sysmk/t2/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1
TESTS_SUBDIRS= 2
SUBDIR= mk
diff --git a/usr.bin/make/tests/sysmk/t1/mk/Makefile b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile
index da052af..ccfd1b6 100644
--- a/usr.bin/make/tests/sysmk/t1/mk/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t1/mk/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t1/mk
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t1/mk
FILESDIR= ${TESTSDIR}
FILES= sys.mk.test
diff --git a/usr.bin/make/tests/sysmk/t1/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test
index 99b8ecc..99b8ecc 100644
--- a/usr.bin/make/tests/sysmk/t1/mk/sys.mk.test
+++ b/usr.bin/bmake/tests/sysmk/t1/mk/sys.mk.test
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/Makefile b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile
index 52fdd8d..e06539a 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t2/2/1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/2/1
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/cleanup b/usr.bin/bmake/tests/sysmk/t2/2/1/cleanup
index c3d58b7..c3d58b7 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/cleanup
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/cleanup
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/expected.status.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/expected.status.1
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.status.1
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/expected.stderr.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/expected.stderr.1
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stderr.1
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/expected.stdout.1 b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1
index 70f1be3..70f1be3 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/expected.stdout.1
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/expected.stdout.1
diff --git a/usr.bin/make/tests/sysmk/t2/2/1/legacy_test.sh b/usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh
index ca817d8..ca817d8 100644
--- a/usr.bin/make/tests/sysmk/t2/2/1/legacy_test.sh
+++ b/usr.bin/bmake/tests/sysmk/t2/2/1/legacy_test.sh
diff --git a/usr.bin/make/tests/sysmk/t1/2/Makefile b/usr.bin/bmake/tests/sysmk/t2/2/Makefile
index 3e5d82c..7d1c68e 100644
--- a/usr.bin/make/tests/sysmk/t1/2/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t2/2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t1/2
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/2
TESTS_SUBDIRS= 1
diff --git a/usr.bin/make/tests/sysmk/t0/Makefile b/usr.bin/bmake/tests/sysmk/t2/Makefile
index 2777925..734c7d8 100644
--- a/usr.bin/make/tests/sysmk/t0/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t2/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t0
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2
TESTS_SUBDIRS= 2
SUBDIR= mk
diff --git a/usr.bin/make/tests/sysmk/t2/mk/Makefile b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile
index 5fdb1ac..29460dc 100644
--- a/usr.bin/make/tests/sysmk/t2/mk/Makefile
+++ b/usr.bin/bmake/tests/sysmk/t2/mk/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t2/mk
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/sysmk/t2/mk
FILESDIR= ${TESTSDIR}
FILES= sys.mk.test
diff --git a/usr.bin/make/tests/sysmk/t2/mk/sys.mk.test b/usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test
index 55632fd..55632fd 100644
--- a/usr.bin/make/tests/sysmk/t2/mk/sys.mk.test
+++ b/usr.bin/bmake/tests/sysmk/t2/mk/sys.mk.test
diff --git a/usr.bin/make/tests/test-new.mk b/usr.bin/bmake/tests/test-new.mk
index f200833..f200833 100644
--- a/usr.bin/make/tests/test-new.mk
+++ b/usr.bin/bmake/tests/test-new.mk
diff --git a/usr.bin/make/tests/variables/Makefile b/usr.bin/bmake/tests/variables/Makefile
index 9f328a8..e010718 100644
--- a/usr.bin/make/tests/variables/Makefile
+++ b/usr.bin/bmake/tests/variables/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/variables
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables
TESTS_SUBDIRS= modifier_M modifier_t opt_V t0
diff --git a/usr.bin/bmake/tests/variables/modifier_M/Makefile b/usr.bin/bmake/tests/variables/modifier_M/Makefile
new file mode 100644
index 0000000..2490382
--- /dev/null
+++ b/usr.bin/bmake/tests/variables/modifier_M/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/modifier_M
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= Makefile.test
+FILES+= expected.status.1
+FILES+= expected.stderr.1
+FILES+= expected.stdout.1
+
+.include <bsd.test.mk>
diff --git a/usr.bin/make/tests/variables/modifier_M/Makefile.test b/usr.bin/bmake/tests/variables/modifier_M/Makefile.test
index 34d4cd4..34d4cd4 100644
--- a/usr.bin/make/tests/variables/modifier_M/Makefile.test
+++ b/usr.bin/bmake/tests/variables/modifier_M/Makefile.test
diff --git a/usr.bin/make/tests/variables/modifier_M/expected.status.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/modifier_M/expected.status.1
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.status.1
diff --git a/usr.bin/make/tests/variables/modifier_M/expected.stderr.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/modifier_M/expected.stderr.1
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.stderr.1
diff --git a/usr.bin/make/tests/variables/modifier_M/expected.stdout.1 b/usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1
index b29e6df..b29e6df 100644
--- a/usr.bin/make/tests/variables/modifier_M/expected.stdout.1
+++ b/usr.bin/bmake/tests/variables/modifier_M/expected.stdout.1
diff --git a/usr.bin/make/tests/variables/modifier_M/legacy_test.sh b/usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh
index 6a3e68f..6a3e68f 100644
--- a/usr.bin/make/tests/variables/modifier_M/legacy_test.sh
+++ b/usr.bin/bmake/tests/variables/modifier_M/legacy_test.sh
diff --git a/usr.bin/make/tests/variables/modifier_t/Makefile b/usr.bin/bmake/tests/variables/modifier_t/Makefile
index 4b5bfee..d108da4 100644
--- a/usr.bin/make/tests/variables/modifier_t/Makefile
+++ b/usr.bin/bmake/tests/variables/modifier_t/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/variables/modifier_t
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/modifier_t
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/variables/modifier_t/Makefile.test b/usr.bin/bmake/tests/variables/modifier_t/Makefile.test
index 53844ee..53844ee 100644
--- a/usr.bin/make/tests/variables/modifier_t/Makefile.test
+++ b/usr.bin/bmake/tests/variables/modifier_t/Makefile.test
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.status.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.status.1
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.1
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.status.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.status.2
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.2
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.status.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.status.3
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.status.3
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.status.3
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stderr.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stderr.1
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.1
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stderr.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stderr.2
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.2
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stderr.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stderr.3
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stderr.3
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stdout.1 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1
index dff38fd..dff38fd 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stdout.1
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.1
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stdout.2 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2
index 71a0f60..71a0f60 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stdout.2
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.2
diff --git a/usr.bin/make/tests/variables/modifier_t/expected.stdout.3 b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3
index 6434c7b..6434c7b 100644
--- a/usr.bin/make/tests/variables/modifier_t/expected.stdout.3
+++ b/usr.bin/bmake/tests/variables/modifier_t/expected.stdout.3
diff --git a/usr.bin/make/tests/variables/modifier_t/legacy_test.sh b/usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh
index 7f14571..7f14571 100644
--- a/usr.bin/make/tests/variables/modifier_t/legacy_test.sh
+++ b/usr.bin/bmake/tests/variables/modifier_t/legacy_test.sh
diff --git a/usr.bin/make/tests/variables/opt_V/Makefile b/usr.bin/bmake/tests/variables/opt_V/Makefile
index 0c3bf17..94a6aff 100644
--- a/usr.bin/make/tests/variables/opt_V/Makefile
+++ b/usr.bin/bmake/tests/variables/opt_V/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/variables/opt_V
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/opt_V
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/variables/opt_V/Makefile.test b/usr.bin/bmake/tests/variables/opt_V/Makefile.test
index 128e511..128e511 100644
--- a/usr.bin/make/tests/variables/opt_V/Makefile.test
+++ b/usr.bin/bmake/tests/variables/opt_V/Makefile.test
diff --git a/usr.bin/make/tests/variables/opt_V/expected.status.1 b/usr.bin/bmake/tests/variables/opt_V/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.status.1
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.status.1
diff --git a/usr.bin/make/tests/variables/opt_V/expected.status.2 b/usr.bin/bmake/tests/variables/opt_V/expected.status.2
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.status.2
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.status.2
diff --git a/usr.bin/make/tests/variables/opt_V/expected.stderr.1 b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.stderr.1
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.1
diff --git a/usr.bin/make/tests/variables/opt_V/expected.stderr.2 b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.2
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.stderr.2
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stderr.2
diff --git a/usr.bin/make/tests/variables/opt_V/expected.stdout.1 b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.1
index 050db40..050db40 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.stdout.1
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.1
diff --git a/usr.bin/make/tests/variables/opt_V/expected.stdout.2 b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.2
index 4da2aef..4da2aef 100644
--- a/usr.bin/make/tests/variables/opt_V/expected.stdout.2
+++ b/usr.bin/bmake/tests/variables/opt_V/expected.stdout.2
diff --git a/usr.bin/make/tests/variables/opt_V/legacy_test.sh b/usr.bin/bmake/tests/variables/opt_V/legacy_test.sh
index 4b1122a..4b1122a 100644
--- a/usr.bin/make/tests/variables/opt_V/legacy_test.sh
+++ b/usr.bin/bmake/tests/variables/opt_V/legacy_test.sh
diff --git a/usr.bin/make/tests/sysmk/t0/2/1/Makefile b/usr.bin/bmake/tests/variables/t0/Makefile
index 2c732f5..c4b98e6 100644
--- a/usr.bin/make/tests/sysmk/t0/2/1/Makefile
+++ b/usr.bin/bmake/tests/variables/t0/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/usr.bin/make/sysmk/t0/2/1
+TESTSDIR= ${TESTSBASE}/usr.bin/bmake/variables/t0
TAP_TESTS_SH= legacy_test
diff --git a/usr.bin/make/tests/variables/t0/Makefile.test b/usr.bin/bmake/tests/variables/t0/Makefile.test
index 1cc58ee..1cc58ee 100644
--- a/usr.bin/make/tests/variables/t0/Makefile.test
+++ b/usr.bin/bmake/tests/variables/t0/Makefile.test
diff --git a/usr.bin/make/tests/variables/t0/expected.status.1 b/usr.bin/bmake/tests/variables/t0/expected.status.1
index 573541a..573541a 100644
--- a/usr.bin/make/tests/variables/t0/expected.status.1
+++ b/usr.bin/bmake/tests/variables/t0/expected.status.1
diff --git a/usr.bin/make/tests/variables/t0/expected.stderr.1 b/usr.bin/bmake/tests/variables/t0/expected.stderr.1
index e69de29..e69de29 100644
--- a/usr.bin/make/tests/variables/t0/expected.stderr.1
+++ b/usr.bin/bmake/tests/variables/t0/expected.stderr.1
diff --git a/usr.bin/make/tests/variables/t0/expected.stdout.1 b/usr.bin/bmake/tests/variables/t0/expected.stdout.1
index e2c70de..e2c70de 100644
--- a/usr.bin/make/tests/variables/t0/expected.stdout.1
+++ b/usr.bin/bmake/tests/variables/t0/expected.stdout.1
diff --git a/usr.bin/make/tests/variables/t0/legacy_test.sh b/usr.bin/bmake/tests/variables/t0/legacy_test.sh
index 8c78e2d..8c78e2d 100644
--- a/usr.bin/make/tests/variables/t0/legacy_test.sh
+++ b/usr.bin/bmake/tests/variables/t0/legacy_test.sh
diff --git a/usr.bin/brandelf/brandelf.1 b/usr.bin/brandelf/brandelf.1
index 467578c..6b84777 100644
--- a/usr.bin/brandelf/brandelf.1
+++ b/usr.bin/brandelf/brandelf.1
@@ -101,4 +101,4 @@ manual page first appeared in
.Fx 2.2 .
.Sh AUTHORS
This manual page was written by
-.An John-Mark Gurney Aq jmg@FreeBSD.org .
+.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .
diff --git a/usr.bin/bsdiff/bsdiff/bsdiff.1 b/usr.bin/bsdiff/bsdiff/bsdiff.1
index f4998ea..bca199f 100644
--- a/usr.bin/bsdiff/bsdiff/bsdiff.1
+++ b/usr.bin/bsdiff/bsdiff/bsdiff.1
@@ -66,7 +66,7 @@ an absolute minimum working set size of 8 times the size of
.Sh SEE ALSO
.Xr bspatch 1
.Sh AUTHORS
-.An Colin Percival Aq cperciva@FreeBSD.org
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
.Sh BUGS
The
.Nm
diff --git a/usr.bin/bsdiff/bspatch/bspatch.1 b/usr.bin/bsdiff/bspatch/bspatch.1
index 352d0cf..edbfb19 100644
--- a/usr.bin/bsdiff/bspatch/bspatch.1
+++ b/usr.bin/bsdiff/bspatch/bspatch.1
@@ -62,7 +62,7 @@ of performance.
.Sh SEE ALSO
.Xr bsdiff 1
.Sh AUTHORS
-.An Colin Percival Aq cperciva@FreeBSD.org
+.An Colin Percival Aq Mt cperciva@FreeBSD.org
.Sh BUGS
The
.Nm
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile
index 32a107a..ef1d7f2 100644
--- a/usr.bin/calendar/Makefile
+++ b/usr.bin/calendar/Makefile
@@ -19,7 +19,6 @@ beforeinstall:
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
.for lang in ${INTER}
- mkdir -p ${DESTDIR}${SHAREDIR}/calendar/${lang}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
${.CURDIR}/calendars/${lang}/calendar.* \
${DESTDIR}${SHAREDIR}/calendar/${lang}
diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd
index a9e8827..e6cd93f 100644
--- a/usr.bin/calendar/calendars/calendar.freebsd
+++ b/usr.bin/calendar/calendars/calendar.freebsd
@@ -143,6 +143,7 @@
05/01 Randall Stewart <rrs@FreeBSD.org> born in Spokane, Washington, United States, 1959
05/02 Wojciech A. Koszek <wkoszek@FreeBSD.org> born in Czestochowa, Poland, 1987
05/03 Brian Dean <bsd@FreeBSD.org> born in Elkins, West Virginia, United States, 1966
+05/03 Patrick Kelsey <pkelsey@FreeBSD.org> born in Freehold, New Jersey, United States, 1976
05/03 Robert Nicholas Maxwell Watson <rwatson@FreeBSD.org> born in Harrow, Middlesex, United Kingdom, 1977
05/04 Denis Peplin <den@FreeBSD.org> born in Nizhniy Novgorod, Russian Federation, 1977
05/08 Kirill Ponomarew <krion@FreeBSD.org> born in Volgograd, Russian Federation, 1977
@@ -279,9 +280,11 @@
09/01 Pyun YongHyeon <yongari@FreeBSD.org> born in Kimcheon, Korea, 1968
09/01 William Grzybowski <wg@FreeBSD.org> born in Parana, Brazil, 1988
09/03 Max Khon <fjoe@FreeBSD.org> born in Novosibirsk, USSR, 1976
+09/03 Allan Jude <allanjude@FreeBSD.org> born in Hamilton, Ontario, Canada, 1984
09/03 Cheng-Lung Sung <clsung@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1977
09/05 Mark Robert Vaughan Murray <markm@FreeBSD.org> born in Harare, Mashonaland, Zimbabwe, 1961
09/05 Adrian Harold Chadd <adrian@FreeBSD.org> born in Perth, Western Australia, Australia, 1979
+09/05 Rodrigo Osorio <rodrigo@FreeBSD.org> born in Montevideo, Uruguay, 1975
09/07 Tim Bishop <tdb@FreeBSD.org> born in Cornwall, United Kingdom, 1978
09/07 Chris Rees <crees@FreeBSD.org> born in Kettering, United Kingdom, 1987
09/08 Boris Samorodov <bsam@FreeBSD.org> born in Krasnodar, Russian Federation, 1963
@@ -362,6 +365,7 @@
12/18 Chris Timmons <cwt@FreeBSD.org> born in Ellensburg, Washington, United States, 1964
12/18 Dag-Erling Smorgrav <des@FreeBSD.org> born in Brussels, Belgium, 1977
12/18 Semen Ustimenko <semenu@FreeBSD.org> born in Novosibirsk, Russian Federation, 1979
+12/19 Stephen Hurd <shurd@FreeBSD.org> born in Estevan, Saskatchewan, Canada, 1975
12/21 Rong-En Fan <rafan@FreeBSD.org> born in Taipei, Taiwan, Republic of China, 1982
12/22 Maxim Sobolev <sobomax@FreeBSD.org> born in Dnepropetrovsk, Ukraine, 1976
12/23 Sean Chittenden <seanc@FreeBSD.org> born in Seattle, Washington, United States, 1979
diff --git a/usr.bin/calendar/calendars/calendar.holiday b/usr.bin/calendar/calendars/calendar.holiday
index d2dcd5a..3fdee69 100644
--- a/usr.bin/calendar/calendars/calendar.holiday
+++ b/usr.bin/calendar/calendars/calendar.holiday
@@ -248,7 +248,7 @@
06/30 Day of the Army in Guatemala
06/MonFirst Jefferson Davis's Birthday in Alabama & Mississippi (1st Monday)
06/MonFirst Jefferson Davis's Birthday in Florida, Georgia, & S. Carolina
-07/01 Dominion Day in Canada
+07/01 Canada Day
07/01 Freedom Day in Suriname
07/01 Independence Day in Burundi
07/01 National Day in Rwanda
diff --git a/usr.bin/clang/clang-tblgen/Makefile b/usr.bin/clang/clang-tblgen/Makefile
index 0f64ad3..34e7aeb 100644
--- a/usr.bin/clang/clang-tblgen/Makefile
+++ b/usr.bin/clang/clang-tblgen/Makefile
@@ -19,4 +19,6 @@ SRCS= ClangASTNodesEmitter.cpp \
LIBDEPS=llvmtablegen \
llvmsupport
+NO_PIE= yes
+
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang-tblgen/Makefile.depend b/usr.bin/clang/clang-tblgen/Makefile.depend
index 70ecfef..71f237e 100644
--- a/usr.bin/clang/clang-tblgen/Makefile.depend
+++ b/usr.bin/clang/clang-tblgen/Makefile.depend
@@ -13,7 +13,7 @@ DIRDEPS = \
lib/libc++ \
lib/libcompiler_rt \
lib/msun \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk
index 8d3f536..b127a77 100644
--- a/usr.bin/clang/clang.prog.mk
+++ b/usr.bin/clang/clang.prog.mk
@@ -1,5 +1,7 @@
# $FreeBSD$
+NO_PIE= yes
+
LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm
.include "../../lib/clang/clang.build.mk"
@@ -9,8 +11,8 @@ DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a
.endfor
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
+DPADD+= ${LIBNCURSESW}
+LDADD+= -lncursesw
BINDIR?= /usr/bin
diff --git a/usr.bin/clang/clang/Makefile b/usr.bin/clang/clang/Makefile
index 74ef867..345efde 100644
--- a/usr.bin/clang/clang/Makefile
+++ b/usr.bin/clang/clang/Makefile
@@ -36,7 +36,7 @@ TGHDRS= CC1AsOptions \
DiagnosticSemaKinds \
Options
-.if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no"
+.if ${MK_CLANG_FULL} != "no"
_clangstaticanalyzer= \
clangstaticanalyzerfrontend \
clangstaticanalyzercheckers \
@@ -46,7 +46,7 @@ _clangarcmigrate= \
_clangrewriter= \
clangrewritefrontend \
clangrewritecore
-.endif # !EARLY_BUILD && MK_CLANG_FULL
+.endif # MK_CLANG_FULL
LIBDEPS=clangfrontendtool \
clangfrontend \
diff --git a/usr.bin/clang/clang/Makefile.depend b/usr.bin/clang/clang/Makefile.depend
index f741403..64aadbc 100644
--- a/usr.bin/clang/clang/Makefile.depend
+++ b/usr.bin/clang/clang/Makefile.depend
@@ -83,7 +83,7 @@ DIRDEPS = \
lib/libc++ \
lib/libcompiler_rt \
lib/msun \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
usr.bin/clang/clang-tblgen.host \
usr.bin/clang/tblgen.host \
diff --git a/usr.bin/clang/tblgen/Makefile b/usr.bin/clang/tblgen/Makefile
index f06150e..31fdc20 100644
--- a/usr.bin/clang/tblgen/Makefile
+++ b/usr.bin/clang/tblgen/Makefile
@@ -42,4 +42,6 @@ SRCS= AsmMatcherEmitter.cpp \
LIBDEPS=llvmtablegen \
llvmsupport
+NO_PIE= yes
+
.include "../clang.prog.mk"
diff --git a/usr.bin/clang/tblgen/Makefile.depend b/usr.bin/clang/tblgen/Makefile.depend
index 70ecfef..71f237e 100644
--- a/usr.bin/clang/tblgen/Makefile.depend
+++ b/usr.bin/clang/tblgen/Makefile.depend
@@ -13,7 +13,7 @@ DIRDEPS = \
lib/libc++ \
lib/libcompiler_rt \
lib/msun \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.bin/compile_et/Makefile b/usr.bin/compile_et/Makefile
index d7177b2..122d745 100644
--- a/usr.bin/compile_et/Makefile
+++ b/usr.bin/compile_et/Makefile
@@ -12,4 +12,6 @@ CFLAGS+=-I. -I${.CURDIR}/../../contrib/com_err
WARNS?= 0
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/cpuset/cpuset.1 b/usr.bin/cpuset/cpuset.1
index 17d9ce9..8ea2702 100644
--- a/usr.bin/cpuset/cpuset.1
+++ b/usr.bin/cpuset/cpuset.1
@@ -191,4 +191,4 @@ The
command first appeared in
.Fx 7.1 .
.Sh AUTHORS
-.An Jeffrey Roberson Aq jeff@FreeBSD.org
+.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/usr.bin/ctlstat/ctlstat.8 b/usr.bin/ctlstat/ctlstat.8
index fef1ff8..22da2bf 100644
--- a/usr.bin/ctlstat/ctlstat.8
+++ b/usr.bin/ctlstat/ctlstat.8
@@ -119,5 +119,5 @@ every 10 seconds.
.Xr ctladm 8 ,
.Xr iostat 8
.Sh AUTHORS
-.An Ken Merry Aq ken@FreeBSD.org
-.An Will Andrews Aq will@FreeBSD.org
+.An Ken Merry Aq Mt ken@FreeBSD.org
+.An Will Andrews Aq Mt will@FreeBSD.org
diff --git a/usr.bin/dtc/dtc.cc b/usr.bin/dtc/dtc.cc
index c04f016..b7d5292 100644
--- a/usr.bin/dtc/dtc.cc
+++ b/usr.bin/dtc/dtc.cc
@@ -100,7 +100,7 @@ main(int argc, char **argv)
clock_t c0 = clock();
class device_tree tree;
fdt::checking::check_manager checks;
- const char *options = "hqI:O:o:V:d:R:S:p:b:fisvH:W:E:DP:";
+ const char *options = "hqI:O:o:V:d:R:S:p:b:fi:svH:W:E:DP:";
// Don't forget to update the man page if any more options are added.
while ((ch = getopt(argc, argv, options)) != -1)
diff --git a/usr.bin/dtc/fdt.cc b/usr.bin/dtc/fdt.cc
index 9998e8c..082ebd9 100644
--- a/usr.bin/dtc/fdt.cc
+++ b/usr.bin/dtc/fdt.cc
@@ -42,6 +42,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "dtb.hh"
namespace dtc
@@ -1078,6 +1080,13 @@ device_tree::buffer_for_file(const char *path)
fprintf(stderr, "Unable to open file %s\n", path);
return 0;
}
+ struct stat st;
+ if (fstat(source, &st) == 0 && S_ISDIR(st.st_mode))
+ {
+ fprintf(stderr, "File %s is a directory\n", path);
+ close(source);
+ return 0;
+ }
input_buffer *b = new mmap_input_buffer(source);
// Keep the buffer that owns the memory around for the lifetime
// of this FDT. Ones simply referring to it may have shorter
diff --git a/usr.bin/dtc/input_buffer.cc b/usr.bin/dtc/input_buffer.cc
index 8f055fe..c83044d 100644
--- a/usr.bin/dtc/input_buffer.cc
+++ b/usr.bin/dtc/input_buffer.cc
@@ -151,7 +151,7 @@ input_buffer::next_token()
start = cursor;
skip_spaces();
// Parse /* comments
- if (((*this)[0] == '/') && ((*this)[1] == '*'))
+ if ((*this)[0] == '/' && (*this)[1] == '*')
{
// eat the start of the comment
++(*this);
@@ -168,13 +168,14 @@ input_buffer::next_token()
// Eat the /
++(*this);
}
- // Parse // comments
- if (((*this)[0] == '/') && ((*this)[1] == '/'))
+ // Parse // comments and # comments
+ if (((*this)[0] == '/' && (*this)[1] == '/') ||
+ (*this)[0] == '#')
{
// eat the start of the comment
++(*this);
++(*this);
- // Find the ending * of */
+ // Find the ending of the line
while (**this != '\n')
{
++(*this);
diff --git a/usr.bin/ee/Makefile b/usr.bin/ee/Makefile
index 7437731..8dcf2f5 100644
--- a/usr.bin/ee/Makefile
+++ b/usr.bin/ee/Makefile
@@ -8,8 +8,8 @@ CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
PROG= ee
LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit
MLINKS= ee.1 ree.1 ee.1 edit.1
-DPADD= ${LIBNCURSES}
-LDADD= -lncurses
+DPADD= ${LIBNCURSESW}
+LDADD= -lncursesw
WARNS?= 2
diff --git a/usr.bin/ee/Makefile.depend b/usr.bin/ee/Makefile.depend
index 4f4df65..3a6e381 100644
--- a/usr.bin/ee/Makefile.depend
+++ b/usr.bin/ee/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
@@ -10,7 +11,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/elf2aout/elf2aout.1 b/usr.bin/elf2aout/elf2aout.1
index 0f4be22..33c6036 100644
--- a/usr.bin/elf2aout/elf2aout.1
+++ b/usr.bin/elf2aout/elf2aout.1
@@ -59,6 +59,6 @@ utility first appeared in
The
.Nm
utility was written by
-.An Jake Burkholder Aq jake@FreeBSD.org .
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
This manual page was written by
-.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.An Tom Rhodes Aq Mt trhodes@FreeBSD.org .
diff --git a/usr.bin/elfdump/elfdump.1 b/usr.bin/elfdump/elfdump.1
index 5818297..dbb3171 100644
--- a/usr.bin/elfdump/elfdump.1
+++ b/usr.bin/elfdump/elfdump.1
@@ -102,10 +102,10 @@ The
.Nm
utility
was written by
-.An Jake Burkholder Aq jake@FreeBSD.org .
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
This
manual page was written by
-.An David O'Brien Aq obrien@FreeBSD.org .
+.An David O'Brien Aq Mt obrien@FreeBSD.org .
.Sh BUGS
Does not fully implement the
.Tn ELF
diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c
index c86e6fc..4ba4529 100644
--- a/usr.bin/elfdump/elfdump.c
+++ b/usr.bin/elfdump/elfdump.c
@@ -167,7 +167,10 @@ static int elf64_offsets[] = {
/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#tag_encodings */
static const char *
-d_tags(u_int64_t tag) {
+d_tags(u_int64_t tag)
+{
+ static char unknown_tag[48];
+
switch (tag) {
case 0: return "DT_NULL";
case 1: return "DT_NEEDED";
@@ -215,6 +218,7 @@ d_tags(u_int64_t tag) {
case 0x6ffffdfe: return "DT_SYMINSZ";
case 0x6ffffdff: return "DT_SYMINENT (DT_VALRNGHI)";
case 0x6ffffe00: return "DT_ADDRRNGLO";
+ case 0x6ffffef5: return "DT_GNU_HASH";
case 0x6ffffef8: return "DT_GNU_CONFLICT";
case 0x6ffffef9: return "DT_GNU_LIBLIST";
case 0x6ffffefa: return "DT_SUNW_CONFIG";
@@ -236,8 +240,10 @@ d_tags(u_int64_t tag) {
case 0x7ffffffd: return "DT_SUNW_AUXILIARY";
case 0x7ffffffe: return "DT_SUNW_USED";
case 0x7fffffff: return "DT_SUNW_FILTER";
- default: return "ERROR: TAG NOT DEFINED";
}
+ snprintf(unknown_tag, sizeof(unknown_tag),
+ "ERROR: TAG NOT DEFINED -- tag 0x%jx", (uintmax_t)tag);
+ return (unknown_tag);
}
static const char *
@@ -303,40 +309,86 @@ static const char *p_flags[] = {
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */
static const char *
-sh_types(u_int64_t sht) {
- switch (sht) {
- case 0: return "SHT_NULL";
- case 1: return "SHT_PROGBITS";
- case 2: return "SHT_SYMTAB";
- case 3: return "SHT_STRTAB";
- case 4: return "SHT_RELA";
- case 5: return "SHT_HASH";
- case 6: return "SHT_DYNAMIC";
- case 7: return "SHT_NOTE";
- case 8: return "SHT_NOBITS";
- case 9: return "SHT_REL";
- case 10: return "SHT_SHLIB";
- case 11: return "SHT_DYNSYM";
- case 14: return "SHT_INIT_ARRAY";
- case 15: return "SHT_FINI_ARRAY";
- case 16: return "SHT_PREINIT_ARRAY";
- case 17: return "SHT_GROUP";
- case 18: return "SHT_SYMTAB_SHNDX";
- /* 0x60000000 - 0x6fffffff operating system-specific semantics */
- case 0x6ffffff0: return "XXX:VERSYM";
- case 0x6ffffff4: return "SHT_SUNW_dof";
- case 0x6ffffff7: return "SHT_GNU_LIBLIST";
- case 0x6ffffffc: return "XXX:VERDEF";
- case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef";
- case 0x6ffffffe: return "SHT_SUNW(GNU)_verneed";
- case 0x6fffffff: return "SHT_SUNW(GNU)_versym";
- /* 0x70000000 - 0x7fffffff processor-specific semantics */
- case 0x70000000: return "SHT_IA_64_EXT";
- case 0x70000001: return "SHT_IA_64_UNWIND";
- case 0x7ffffffd: return "XXX:AUXILIARY";
- case 0x7fffffff: return "XXX:FILTER";
- /* 0x80000000 - 0xffffffff application programs */
- default: return "ERROR: SHT NOT DEFINED";
+sh_types(uint64_t machine, uint64_t sht) {
+ static char unknown_buf[64];
+
+ if (sht < 0x60000000) {
+ switch (sht) {
+ case 0: return "SHT_NULL";
+ case 1: return "SHT_PROGBITS";
+ case 2: return "SHT_SYMTAB";
+ case 3: return "SHT_STRTAB";
+ case 4: return "SHT_RELA";
+ case 5: return "SHT_HASH";
+ case 6: return "SHT_DYNAMIC";
+ case 7: return "SHT_NOTE";
+ case 8: return "SHT_NOBITS";
+ case 9: return "SHT_REL";
+ case 10: return "SHT_SHLIB";
+ case 11: return "SHT_DYNSYM";
+ case 14: return "SHT_INIT_ARRAY";
+ case 15: return "SHT_FINI_ARRAY";
+ case 16: return "SHT_PREINIT_ARRAY";
+ case 17: return "SHT_GROUP";
+ case 18: return "SHT_SYMTAB_SHNDX";
+ }
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "ERROR: SHT %ju NOT DEFINED", (uintmax_t)sht);
+ return (unknown_buf);
+ } else if (sht < 0x70000000) {
+ /* 0x60000000-0x6fffffff operating system-specific semantics */
+ switch (sht) {
+ case 0x6ffffff0: return "XXX:VERSYM";
+ case 0x6ffffff4: return "SHT_SUNW_dof";
+ case 0x6ffffff6: return "SHT_GNU_HASH";
+ case 0x6ffffff7: return "SHT_GNU_LIBLIST";
+ case 0x6ffffffc: return "XXX:VERDEF";
+ case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef";
+ case 0x6ffffffe: return "SHT_SUNW(GNU)_verneed";
+ case 0x6fffffff: return "SHT_SUNW(GNU)_versym";
+ }
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "ERROR: OS-SPECIFIC SHT 0x%jx NOT DEFINED",
+ (uintmax_t)sht);
+ return (unknown_buf);
+ } else if (sht < 0x80000000) {
+ /* 0x70000000-0x7fffffff processor-specific semantics */
+ switch (machine) {
+ case EM_ARM:
+ switch (sht) {
+ case 0x70000001: return "SHT_ARM_EXIDX";
+ case 0x70000002: return "SHT_ARM_PREEMPTMAP";
+ case 0x70000003: return "SHT_ARM_ATTRIBUTES";
+ case 0x70000004: return "SHT_ARM_DEBUGOVERLAY";
+ case 0x70000005: return "SHT_ARM_OVERLAYSECTION";
+ }
+ break;
+ case EM_MIPS:
+ switch (sht) {
+ case 0x7000000d: return "SHT_MIPS_OPTIONS";
+ }
+ break;
+ case EM_IA_64:
+ switch (sht) {
+ case 0x70000000: return "SHT_IA_64_EXT";
+ case 0x70000001: return "SHT_IA_64_UNWIND";
+ }
+ break;
+ }
+ switch (sht) {
+ case 0x7ffffffd: return "XXX:AUXILIARY";
+ case 0x7fffffff: return "XXX:FILTER";
+ }
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "ERROR: PROCESSOR-SPECIFIC SHT 0x%jx NOT DEFINED",
+ (uintmax_t)sht);
+ return (unknown_buf);
+ } else {
+ /* 0x80000000-0xffffffff application programs */
+ snprintf(unknown_buf, sizeof(unknown_buf),
+ "ERROR: SHT 0x%jx NOT DEFINED",
+ (uintmax_t)sht);
+ return (unknown_buf);
}
}
@@ -495,11 +547,19 @@ main(int ac, char **av)
phnum = elf_get_quarter(e, e, E_PHNUM);
shentsize = elf_get_quarter(e, e, E_SHENTSIZE);
p = (char *)e + phoff;
- sh = (char *)e + shoff;
- shnum = elf_get_shnum(e, sh);
- shstrndx = elf_get_shstrndx(e, sh);
- offset = elf_get_off(e, (char *)sh + shstrndx * shentsize, SH_OFFSET);
- shstrtab = (char *)e + offset;
+ if (shoff > 0) {
+ sh = (char *)e + shoff;
+ shnum = elf_get_shnum(e, sh);
+ shstrndx = elf_get_shstrndx(e, sh);
+ offset = elf_get_off(e, (char *)sh + shstrndx * shentsize,
+ SH_OFFSET);
+ shstrtab = (char *)e + offset;
+ } else {
+ sh = NULL;
+ shnum = 0;
+ shstrndx = 0;
+ shstrtab = NULL;
+ }
for (i = 0; (u_int64_t)i < shnum; i++) {
name = elf_get_word(e, (char *)sh + i * shentsize, SH_NAME);
offset = elf_get_off(e, (char *)sh + i * shentsize, SH_OFFSET);
@@ -616,8 +676,6 @@ elf_print_ehdr(Elf32_Ehdr *e, void *sh)
phentsize = elf_get_quarter(e, e, E_PHENTSIZE);
phnum = elf_get_quarter(e, e, E_PHNUM);
shentsize = elf_get_quarter(e, e, E_SHENTSIZE);
- shnum = elf_get_shnum(e, sh);
- shstrndx = elf_get_shstrndx(e, sh);
fprintf(out, "\nelf header:\n");
fprintf(out, "\n");
fprintf(out, "\te_ident: %s %s %s\n", ei_classes[class], ei_data[data],
@@ -633,8 +691,12 @@ elf_print_ehdr(Elf32_Ehdr *e, void *sh)
fprintf(out, "\te_phentsize: %jd\n", (intmax_t)phentsize);
fprintf(out, "\te_phnum: %jd\n", (intmax_t)phnum);
fprintf(out, "\te_shentsize: %jd\n", (intmax_t)shentsize);
- fprintf(out, "\te_shnum: %jd\n", (intmax_t)shnum);
- fprintf(out, "\te_shstrndx: %jd\n", (intmax_t)shstrndx);
+ if (sh != NULL) {
+ shnum = elf_get_shnum(e, sh);
+ shstrndx = elf_get_shstrndx(e, sh);
+ fprintf(out, "\te_shnum: %jd\n", (intmax_t)shnum);
+ fprintf(out, "\te_shstrndx: %jd\n", (intmax_t)shstrndx);
+ }
}
static void
@@ -694,9 +756,16 @@ elf_print_shdr(Elf32_Ehdr *e, void *sh)
u_int64_t info;
u_int64_t addralign;
u_int64_t entsize;
+ u_int64_t machine;
void *v;
int i;
+ if (sh == NULL) {
+ fprintf(out, "\nNo section headers\n");
+ return;
+ }
+
+ machine = elf_get_quarter(e, e, E_MACHINE);
shentsize = elf_get_quarter(e, e, E_SHENTSIZE);
shnum = elf_get_shnum(e, sh);
fprintf(out, "\nsection header:\n");
@@ -715,7 +784,7 @@ elf_print_shdr(Elf32_Ehdr *e, void *sh)
fprintf(out, "\n");
fprintf(out, "entry: %d\n", i);
fprintf(out, "\tsh_name: %s\n", shstrtab + name);
- fprintf(out, "\tsh_type: %s\n", sh_types(type));
+ fprintf(out, "\tsh_type: %s\n", sh_types(machine, type));
fprintf(out, "\tsh_flags: %s\n", sh_flags[flags & 0x7]);
fprintf(out, "\tsh_addr: %#jx\n", addr);
fprintf(out, "\tsh_offset: %jd\n", (intmax_t)offset);
diff --git a/usr.bin/fetch/fetch.1 b/usr.bin/fetch/fetch.1
index b9d4785..10df421 100644
--- a/usr.bin/fetch/fetch.1
+++ b/usr.bin/fetch/fetch.1
@@ -389,17 +389,17 @@ This implementation first appeared in
The original implementation of
.Nm
was done by
-.An Jean-Marc Zucconi Aq jmz@FreeBSD.org .
+.An Jean-Marc Zucconi Aq Mt jmz@FreeBSD.org .
It was extensively re-worked for
.Fx 2.2
by
-.An Garrett Wollman Aq wollman@FreeBSD.org ,
+.An Garrett Wollman Aq Mt wollman@FreeBSD.org ,
and later completely rewritten to use the
.Xr fetch 3
library by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org
and
-.An Michael Gmelin Aq freebsd@grem.de .
+.An Michael Gmelin Aq Mt freebsd@grem.de .
.Sh NOTES
The
.Fl b
diff --git a/usr.bin/file/Makefile b/usr.bin/file/Makefile
index da32084..4054365 100644
--- a/usr.bin/file/Makefile
+++ b/usr.bin/file/Makefile
@@ -21,7 +21,8 @@
# 4. This notice may not be removed or altered.
SRCDIR= ${.CURDIR}/../../contrib/file
-.PATH: ${SRCDIR}
+.PATH: ${SRCDIR}/src
+.PATH: ${SRCDIR}/doc
PROG= file
diff --git a/usr.bin/fstat/fuser.1 b/usr.bin/fstat/fuser.1
index d13e2b5..7bae409 100644
--- a/usr.bin/fstat/fuser.1
+++ b/usr.bin/fstat/fuser.1
@@ -139,7 +139,7 @@ utility appeared in
The
.Nm
utility and this manual page was written by
-.An Stanislav Sedov Aq stas@FreeBSD.org .
+.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
.Sh BUGS
Since
.Nm
diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile
index abdd6b7..2cd7f36 100644
--- a/usr.bin/ftp/Makefile
+++ b/usr.bin/ftp/Makefile
@@ -20,8 +20,8 @@ CFLAGS+= -DINET6
.endif
CFLAGS+= -I${.CURDIR} -I${TNFTP}
-LDADD= -ledit -ltermcap -lutil
-DPADD= ${LIBEDIT} ${LIBTERMCAP} ${LIBUTIL}
+LDADD= -ledit -ltermcapw -lutil
+DPADD= ${LIBEDIT} ${LIBTERMCAPW} ${LIBUTIL}
WARNS?= 2
diff --git a/usr.bin/ftp/Makefile.depend b/usr.bin/ftp/Makefile.depend
index b176abf..c43a11a 100644
--- a/usr.bin/ftp/Makefile.depend
+++ b/usr.bin/ftp/Makefile.depend
@@ -13,7 +13,6 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libedit \
lib/libutil \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/gcore/Makefile b/usr.bin/gcore/Makefile
index 0f37281..7fff540 100644
--- a/usr.bin/gcore/Makefile
+++ b/usr.bin/gcore/Makefile
@@ -6,6 +6,10 @@ SRCS= elfcore.c gcore.c
DPADD= ${LIBSBUF} ${LIBUTIL}
LDADD= -lsbuf -lutil
+.if ${MACHINE_ARCH} == "amd64"
+SRCS+= elf32core.c
+.endif
+
WARNS?= 1
.include <bsd.prog.mk>
diff --git a/usr.bin/gcore/elf32core.c b/usr.bin/gcore/elf32core.c
new file mode 100644
index 0000000..de48500
--- /dev/null
+++ b/usr.bin/gcore/elf32core.c
@@ -0,0 +1,66 @@
+/* $FreeBSD$ */
+#ifndef __LP64__
+#error "this file must be compiled for LP64."
+#endif
+
+#define __ELF_WORD_SIZE 32
+#define _MACHINE_ELF_WANT_32BIT
+
+#include <sys/procfs.h>
+
+struct prpsinfo32 {
+ int pr_version;
+ u_int pr_psinfosz;
+ char pr_fname[PRFNAMESZ+1];
+ char pr_psargs[PRARGSZ+1];
+};
+
+struct prstatus32 {
+ int pr_version;
+ u_int pr_statussz;
+ u_int pr_gregsetsz;
+ u_int pr_fpregsetsz;
+ int pr_osreldate;
+ int pr_cursig;
+ pid_t pr_pid;
+ struct reg32 pr_reg;
+};
+
+#define ELFCORE_COMPAT_32 1
+#include "elfcore.c"
+
+static void
+elf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs)
+{
+#ifdef __amd64__
+ rd->r_gs = rs->r_gs;
+ rd->r_fs = rs->r_fs;
+ rd->r_es = rs->r_es;
+ rd->r_ds = rs->r_ds;
+ rd->r_edi = rs->r_rdi;
+ rd->r_esi = rs->r_rsi;
+ rd->r_ebp = rs->r_rbp;
+ rd->r_ebx = rs->r_rbx;
+ rd->r_edx = rs->r_rdx;
+ rd->r_ecx = rs->r_rcx;
+ rd->r_eax = rs->r_rax;
+ rd->r_eip = rs->r_rip;
+ rd->r_cs = rs->r_cs;
+ rd->r_eflags = rs->r_rflags;
+ rd->r_esp = rs->r_rsp;
+ rd->r_ss = rs->r_ss;
+#else
+#error Unsupported architecture
+#endif
+}
+
+static void
+elf_convert_fpregset(elfcore_fpregset_t *rd, struct fpreg *rs)
+{
+#ifdef __amd64__
+ /* XXX this is wrong... */
+ memcpy(rd, rs, sizeof(*rd));
+#else
+#error Unsupported architecture
+#endif
+}
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c
index 20e801a..f857dcf 100644
--- a/usr.bin/gcore/elfcore.c
+++ b/usr.bin/gcore/elfcore.c
@@ -28,6 +28,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/endian.h>
#include <sys/param.h>
#include <sys/procfs.h>
#include <sys/ptrace.h>
@@ -73,6 +74,22 @@ struct sseg_closure {
size_t size; /* Total size of all writable segments. */
};
+#ifdef ELFCORE_COMPAT_32
+typedef struct fpreg32 elfcore_fpregset_t;
+typedef struct reg32 elfcore_gregset_t;
+typedef struct prpsinfo32 elfcore_prpsinfo_t;
+typedef struct prstatus32 elfcore_prstatus_t;
+static void elf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs);
+static void elf_convert_fpregset(elfcore_fpregset_t *rd, struct fpreg *rs);
+#else
+typedef fpregset_t elfcore_fpregset_t;
+typedef gregset_t elfcore_gregset_t;
+typedef prpsinfo_t elfcore_prpsinfo_t;
+typedef prstatus_t elfcore_prstatus_t;
+#define elf_convert_gregset(d,s) *d = *s
+#define elf_convert_fpregset(d,s) *d = *s
+#endif
+
typedef void* (*notefunc_t)(void *, size_t *);
static void cb_put_phdr(vm_map_entry_t, void *);
@@ -108,13 +125,28 @@ elf_ident(int efd, pid_t pid __unused, char *binfile __unused)
{
Elf_Ehdr hdr;
int cnt;
+ uint16_t machine;
cnt = read(efd, &hdr, sizeof(hdr));
if (cnt != sizeof(hdr))
return (0);
- if (IS_ELF(hdr))
- return (1);
- return (0);
+ if (!IS_ELF(hdr))
+ return (0);
+ switch (hdr.e_ident[EI_DATA]) {
+ case ELFDATA2LSB:
+ machine = le16toh(hdr.e_machine);
+ break;
+ case ELFDATA2MSB:
+ machine = be16toh(hdr.e_machine);
+ break;
+ default:
+ return (0);
+ }
+ if (!ELF_MACHINE_OK(machine))
+ return (0);
+
+ /* Looks good. */
+ return (1);
}
static void
@@ -194,7 +226,7 @@ elf_coredump(int efd __unused, int fd, pid_t pid)
uintmax_t nleft = php->p_filesz;
iorequest.piod_op = PIOD_READ_D;
- iorequest.piod_offs = (caddr_t)php->p_vaddr;
+ iorequest.piod_offs = (caddr_t)(uintptr_t)php->p_vaddr;
while (nleft > 0) {
char buf[8*1024];
size_t nwant;
@@ -311,6 +343,7 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep)
elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb);
}
+#ifndef ELFCORE_COMPAT_32
elf_putnote(NT_PROCSTAT_PROC, elf_note_procstat_proc, &pid, sb);
elf_putnote(NT_PROCSTAT_FILES, elf_note_procstat_files, &pid, sb);
elf_putnote(NT_PROCSTAT_VMMAP, elf_note_procstat_vmmap, &pid, sb);
@@ -321,6 +354,7 @@ elf_putnotes(pid_t pid, struct sbuf *sb, size_t *sizep)
elf_putnote(NT_PROCSTAT_PSSTRINGS, elf_note_procstat_psstrings, &pid,
sb);
elf_putnote(NT_PROCSTAT_AUXV, elf_note_procstat_auxv, &pid, sb);
+#endif
size = sbuf_end_section(sb, old_len, 1, 0);
if (size == -1)
@@ -491,7 +525,7 @@ static void *
elf_note_prpsinfo(void *arg, size_t *sizep)
{
pid_t pid;
- prpsinfo_t *psinfo;
+ elfcore_prpsinfo_t *psinfo;
struct kinfo_proc kip;
size_t len;
int name[4];
@@ -501,7 +535,7 @@ elf_note_prpsinfo(void *arg, size_t *sizep)
if (psinfo == NULL)
errx(1, "out of memory");
psinfo->pr_version = PRPSINFO_VERSION;
- psinfo->pr_psinfosz = sizeof(prpsinfo_t);
+ psinfo->pr_psinfosz = sizeof(*psinfo);
name[0] = CTL_KERN;
name[1] = KERN_PROC;
@@ -523,19 +557,21 @@ static void *
elf_note_prstatus(void *arg, size_t *sizep)
{
lwpid_t tid;
- prstatus_t *status;
+ elfcore_prstatus_t *status;
+ struct reg greg;
tid = *(lwpid_t *)arg;
status = calloc(1, sizeof(*status));
if (status == NULL)
errx(1, "out of memory");
status->pr_version = PRSTATUS_VERSION;
- status->pr_statussz = sizeof(prstatus_t);
- status->pr_gregsetsz = sizeof(gregset_t);
- status->pr_fpregsetsz = sizeof(fpregset_t);
+ status->pr_statussz = sizeof(*status);
+ status->pr_gregsetsz = sizeof(elfcore_gregset_t);
+ status->pr_fpregsetsz = sizeof(elfcore_fpregset_t);
status->pr_osreldate = __FreeBSD_version;
status->pr_pid = tid;
- ptrace(PT_GETREGS, tid, (void *)&status->pr_reg, 0);
+ ptrace(PT_GETREGS, tid, (void *)&greg, 0);
+ elf_convert_gregset(&status->pr_reg, &greg);
*sizep = sizeof(*status);
return (status);
@@ -545,13 +581,15 @@ static void *
elf_note_fpregset(void *arg, size_t *sizep)
{
lwpid_t tid;
- prfpregset_t *fpregset;
+ elfcore_fpregset_t *fpregset;
+ fpregset_t fpreg;
tid = *(lwpid_t *)arg;
fpregset = calloc(1, sizeof(*fpregset));
if (fpregset == NULL)
errx(1, "out of memory");
- ptrace(PT_GETFPREGS, tid, (void *)fpregset, 0);
+ ptrace(PT_GETFPREGS, tid, (void *)&fpreg, 0);
+ elf_convert_fpregset(fpregset, &fpreg);
*sizep = sizeof(*fpregset);
return (fpregset);
@@ -700,5 +738,5 @@ elf_note_procstat_rlimit(void *arg, size_t *sizep)
return (buf);
}
-struct dumpers elfdump = { elf_ident, elf_coredump };
-TEXT_SET(dumpset, elfdump);
+struct dumpers __elfN(dump) = { elf_ident, elf_coredump };
+TEXT_SET(dumpset, __elfN(dump));
diff --git a/usr.bin/getconf/Makefile.depend b/usr.bin/getconf/Makefile.depend
index 3cc34a1..580f1ec 100644
--- a/usr.bin/getconf/Makefile.depend
+++ b/usr.bin/getconf/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/getconf/getconf.1 b/usr.bin/getconf/getconf.1
index c3baed9..29a2026 100644
--- a/usr.bin/getconf/getconf.1
+++ b/usr.bin/getconf/getconf.1
@@ -204,4 +204,4 @@ The
utility first appeared in
.Fx 5.0 .
.Sh AUTHORS
-.An Garrett A. Wollman Aq wollman@lcs.mit.edu
+.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h
index c841a20..c8140eb 100644
--- a/usr.bin/gprof/gprof.h
+++ b/usr.bin/gprof/gprof.h
@@ -46,9 +46,6 @@
#if __i386__
# include "i386.h"
#endif
-#if __ia64__
-# include "ia64.h"
-#endif
#if __mips__
# include "mips.h"
#endif
diff --git a/usr.bin/grep/Makefile.depend b/usr.bin/grep/Makefile.depend
index b8b81d7..6dc4e1d 100644
--- a/usr.bin/grep/Makefile.depend
+++ b/usr.bin/grep/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
gnu/lib/libregex \
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 74446b6..5631877 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: grep.c,v 1.4 2011/02/16 01:31:33 joerg Exp $ */
+/* $NetBSD: grep.c,v 1.6 2011/04/18 03:48:23 joerg Exp $ */
/* $FreeBSD$ */
/* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <libgen.h>
#include <locale.h>
#include <stdbool.h>
+#define _WITH_GETLINE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -304,6 +305,7 @@ read_patterns(const char *fn)
FILE *f;
char *line;
size_t len;
+ ssize_t rlen;
if ((f = fopen(fn, "r")) == NULL)
err(2, "%s", fn);
@@ -311,8 +313,11 @@ read_patterns(const char *fn)
fclose(f);
return;
}
- while ((line = fgetln(f, &len)) != NULL)
+ len = 0;
+ line = NULL;
+ while ((rlen = getline(&line, &len, f)) != -1)
add_pattern(line, line[0] == '\n' ? 0 : len);
+ free(line);
if (ferror(f))
err(2, "%s", fn);
fclose(f);
diff --git a/usr.bin/grep/queue.c b/usr.bin/grep/queue.c
index afcb827..1887888 100644
--- a/usr.bin/grep/queue.c
+++ b/usr.bin/grep/queue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: queue.c,v 1.2 2011/02/16 01:31:33 joerg Exp $ */
+/* $NetBSD: queue.c,v 1.5 2011/08/31 16:24:57 plunky Exp $ */
/* $FreeBSD$ */
/*-
@@ -68,8 +68,11 @@ enqueue(struct str *x)
STAILQ_INSERT_TAIL(&queue, item, list);
- if (++count > Bflag)
- free(dequeue());
+ if (++count > Bflag) {
+ item = dequeue();
+ free(item->data.dat);
+ free(item);
+ }
}
static struct qentry *
@@ -92,7 +95,8 @@ printqueue(void)
struct qentry *item;
while ((item = dequeue()) != NULL) {
- printline(&item->data, '-', (regmatch_t *)NULL, 0);
+ printline(&item->data, '-', NULL, 0);
+ free(item->data.dat);
free(item);
}
}
@@ -102,6 +106,8 @@ clearqueue(void)
{
struct qentry *item;
- while ((item = dequeue()) != NULL)
+ while ((item = dequeue()) != NULL) {
+ free(item->data.dat);
free(item);
+ }
}
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c
index 0a3706f..3ec12fa 100644
--- a/usr.bin/grep/util.c
+++ b/usr.bin/grep/util.c
@@ -302,7 +302,7 @@ procline(struct str *l, int nottext)
r = REG_NOMATCH;
/* Check for whole word match */
if (r == 0 && (wflag || fg_pattern[i].word)) {
- wint_t wbegin, wend;
+ wchar_t wbegin, wend;
wbegin = wend = L' ';
if (pmatch.rm_so != 0 &&
@@ -336,7 +336,7 @@ procline(struct str *l, int nottext)
}
/* One pass if we are not recording matches */
- if ((color == NULL && !oflag) || qflag || lflag)
+ if (!wflag && ((color == NULL && !oflag) || qflag || lflag))
break;
if (st == (size_t)pmatch.rm_so)
diff --git a/usr.bin/gzip/gzip.1 b/usr.bin/gzip/gzip.1
index ca1ca15..ba78bd0 100644
--- a/usr.bin/gzip/gzip.1
+++ b/usr.bin/gzip/gzip.1
@@ -214,9 +214,9 @@ and first appeared in
This implementation of
.Nm
was written by
-.An Matthew R. Green Aq mrg@eterna.com.au
+.An Matthew R. Green Aq Mt mrg@eterna.com.au
with unpack support written by
-.An Xin LI Aq delphij@FreeBSD.org .
+.An Xin LI Aq Mt delphij@FreeBSD.org .
.Sh BUGS
According to RFC 1952, the recorded file size is stored in a 32-bit
integer, therefore, it can not represent files larger than 4GB.
diff --git a/usr.bin/gzip/zuncompress.c b/usr.bin/gzip/zuncompress.c
index f1b05fd..6069cae 100644
--- a/usr.bin/gzip/zuncompress.c
+++ b/usr.bin/gzip/zuncompress.c
@@ -145,7 +145,7 @@ zuncompress(FILE *in, FILE *out, char *pre, size_t prelen,
else
compressed_pre = NULL;
- while ((bin = fread(buf, 1, sizeof(buf), in)) != 0) {
+ while ((bin = fread(buf, 1, BUFSIZE, in)) != 0) {
if (tflag == 0 && (off_t)fwrite(buf, 1, bin, out) != bin) {
free(buf);
return -1;
diff --git a/usr.bin/iconv/iconv.c b/usr.bin/iconv/iconv.c
index 77dd11a..dc2aec0 100644
--- a/usr.bin/iconv/iconv.c
+++ b/usr.bin/iconv/iconv.c
@@ -41,13 +41,11 @@
#include <string.h>
#include <unistd.h>
-static unsigned long long invalids;
+static int do_conv(FILE *, const char *, const char *, bool, bool);
+static int do_list(unsigned int, const char * const *, void *);
+static void usage(void) __dead2;
-static void do_conv(FILE *, const char *, const char *, bool, bool);
-static int do_list(unsigned int, const char * const *, void *);
-static void usage(void);
-
-static struct option long_options[] = {
+static const struct option long_options[] = {
{"from-code", required_argument, NULL, 'f'},
{"list", no_argument, NULL, 'l'},
{"silent", no_argument, NULL, 's'},
@@ -68,12 +66,13 @@ usage(void)
#define INBUFSIZE 1024
#define OUTBUFSIZE (INBUFSIZE * 2)
-static void
+static int
do_conv(FILE *fp, const char *from, const char *to, bool silent,
bool hide_invalid)
{
iconv_t cd;
char inbuf[INBUFSIZE], outbuf[OUTBUFSIZE], *out;
+ unsigned long long invalids;
const char *in;
size_t inbytes, outbytes, ret;
@@ -84,8 +83,9 @@ do_conv(FILE *fp, const char *from, const char *to, bool silent,
int arg = 1;
if (iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, (void *)&arg) == -1)
- err(1, NULL);
+ err(EXIT_FAILURE, NULL);
}
+ invalids = 0;
while ((inbytes = fread(inbuf, 1, INBUFSIZE, fp)) > 0) {
in = inbuf;
while (inbytes > 0) {
@@ -135,6 +135,7 @@ do_conv(FILE *fp, const char *from, const char *to, bool silent,
warnx("warning: invalid characters: %llu", invalids);
iconv_close(cd);
+ return (invalids > 0);
}
static int
@@ -157,7 +158,7 @@ main(int argc, char **argv)
{
FILE *fp;
char *opt_f, *opt_t;
- int ch, i;
+ int ch, i, res;
bool opt_c = false, opt_s = false;
opt_f = opt_t = strdup("");
@@ -202,18 +203,18 @@ main(int argc, char **argv)
if ((strcmp(opt_f, "") == 0) && (strcmp(opt_t, "") == 0))
usage();
if (argc == 0)
- do_conv(stdin, opt_f, opt_t, opt_s, opt_c);
+ res = do_conv(stdin, opt_f, opt_t, opt_s, opt_c);
else {
+ res = 0;
for (i = 0; i < argc; i++) {
fp = (strcmp(argv[i], "-") != 0) ?
fopen(argv[i], "r") : stdin;
if (fp == NULL)
err(EXIT_FAILURE, "Cannot open `%s'",
argv[i]);
- do_conv(fp, opt_f, opt_t, opt_s,
- opt_c);
+ res |= do_conv(fp, opt_f, opt_t, opt_s, opt_c);
(void)fclose(fp);
}
}
- return (EXIT_SUCCESS);
+ return (res == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/usr.bin/ipcs/ipcs.1 b/usr.bin/ipcs/ipcs.1
index 7d23134..22cf3db 100644
--- a/usr.bin/ipcs/ipcs.1
+++ b/usr.bin/ipcs/ipcs.1
@@ -169,7 +169,7 @@ default system name list
.Sh SEE ALSO
.Xr ipcrm 1
.Sh AUTHORS
-.An Thorsten Lockert Aq tholo@sigmasoft.com
+.An Thorsten Lockert Aq Mt tholo@sigmasoft.com
.Sh BUGS
This manual page is woefully incomplete, because it does not
at all attempt to explain the information printed by
diff --git a/usr.bin/iscsictl/iscsictl.8 b/usr.bin/iscsictl/iscsictl.8
index 1fab1d7..845718b 100644
--- a/usr.bin/iscsictl/iscsictl.8
+++ b/usr.bin/iscsictl/iscsictl.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 24, 2014
+.Dd July 18, 2014
.Dt ISCSICTL 8
.Os
.Sh NAME
@@ -47,6 +47,17 @@
.Fl A
.Fl n Ar nickname Op Fl c Ar path
.Nm
+.Fl M
+.Fl i Ar session-id
+.Op Fl p Ar portal
+.Op Fl t Ar target
+.Op Fl u Ar user
+.Op Fl s Ar secret
+.Nm
+.Fl M
+.Fl i Ar session-id
+.Op Fl n Ar nickname Op Fl c Ar path
+.Nm
.Fl R
.Op Fl p Ar portal
.Op Fl t Ar target
@@ -68,6 +79,8 @@ The following options are available:
.Bl -tag -width ".Fl A"
.It Fl A
Add session.
+.It Fl M
+Modify session.
.It Fl R
Remove session.
.It Fl L
@@ -83,7 +96,11 @@ The default is
Target host name or address used for SendTargets discovery.
When used, it will add a temporary discovery session.
After discovery is done, sessions will be added for each discovered target,
-and the temporary discovery sesion will be removed.
+and the temporary discovery session will be removed.
+.It Fl i
+Session ID, as displayed by
+.Nm
+.Fl v .
.It Fl n
The "nickname" of session defined in the configuration file.
.It Fl p
@@ -98,7 +115,7 @@ CHAP login.
Verbose mode.
.El
.Pp
-Certain parameters are neccessary when adding a session.
+Certain parameters are necessary when adding a session.
One can specify these either via command line (using the
.Fl t ,
.Fl p ,
@@ -165,5 +182,5 @@ command appeared in
The
.Nm
was developed by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
under sponsorship from the FreeBSD Foundation.
diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c
index 39a31c6..75d329f 100644
--- a/usr.bin/iscsictl/iscsictl.c
+++ b/usr.bin/iscsictl/iscsictl.c
@@ -350,6 +350,82 @@ kernel_add(int iscsi_fd, const struct target *targ)
}
static int
+kernel_modify(int iscsi_fd, unsigned int session_id, const struct target *targ)
+{
+ struct iscsi_session_modify ism;
+ int error;
+
+ memset(&ism, 0, sizeof(ism));
+ ism.ism_session_id = session_id;
+ conf_from_target(&ism.ism_conf, targ);
+ error = ioctl(iscsi_fd, ISCSISMODIFY, &ism);
+ if (error != 0)
+ warn("ISCSISMODIFY");
+ return (error);
+}
+
+static void
+kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target,
+ const char *target_addr, const char *user, const char *secret)
+{
+ struct iscsi_session_state *states = NULL;
+ struct iscsi_session_state *state;
+ struct iscsi_session_conf *conf;
+ struct iscsi_session_list isl;
+ struct iscsi_session_modify ism;
+ unsigned int i, nentries = 1;
+ int error;
+
+ for (;;) {
+ states = realloc(states,
+ nentries * sizeof(struct iscsi_session_state));
+ if (states == NULL)
+ err(1, "realloc");
+
+ memset(&isl, 0, sizeof(isl));
+ isl.isl_nentries = nentries;
+ isl.isl_pstates = states;
+
+ error = ioctl(iscsi_fd, ISCSISLIST, &isl);
+ if (error != 0 && errno == EMSGSIZE) {
+ nentries *= 4;
+ continue;
+ }
+ break;
+ }
+ if (error != 0)
+ errx(1, "ISCSISLIST");
+
+ for (i = 0; i < isl.isl_nentries; i++) {
+ state = &states[i];
+
+ if (state->iss_id == session_id)
+ break;
+ }
+ if (i == isl.isl_nentries)
+ errx(1, "session-id %u not found", session_id);
+
+ conf = &state->iss_conf;
+
+ if (target != NULL)
+ strlcpy(conf->isc_target, target, sizeof(conf->isc_target));
+ if (target_addr != NULL)
+ strlcpy(conf->isc_target_addr, target_addr,
+ sizeof(conf->isc_target_addr));
+ if (user != NULL)
+ strlcpy(conf->isc_user, user, sizeof(conf->isc_user));
+ if (secret != NULL)
+ strlcpy(conf->isc_secret, secret, sizeof(conf->isc_secret));
+
+ memset(&ism, 0, sizeof(ism));
+ ism.ism_session_id = session_id;
+ memcpy(&ism.ism_conf, conf, sizeof(ism.ism_conf));
+ error = ioctl(iscsi_fd, ISCSISMODIFY, &ism);
+ if (error != 0)
+ warn("ISCSISMODIFY");
+}
+
+static int
kernel_remove(int iscsi_fd, const struct target *targ)
{
struct iscsi_session_remove isr;
@@ -404,7 +480,7 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
state = &states[i];
conf = &state->iss_conf;
- printf("Session ID: %d\n", state->iss_id);
+ printf("Session ID: %u\n", state->iss_id);
printf("Initiator name: %s\n", conf->isc_initiator);
printf("Initiator portal: %s\n",
conf->isc_initiator_addr);
@@ -482,6 +558,10 @@ usage(void)
"[-u user -s secret]\n");
fprintf(stderr, " iscsictl -A -a [-c path]\n");
fprintf(stderr, " iscsictl -A -n nickname [-c path]\n");
+ fprintf(stderr, " iscsictl -M -i session-id [-p portal] "
+ "[-t target] [-u user] [-s secret]\n");
+ fprintf(stderr, " iscsictl -M -i session-id -n nickname "
+ "[-c path]\n");
fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n");
fprintf(stderr, " iscsictl -R -a\n");
fprintf(stderr, " iscsictl -R -n nickname [-c path]\n");
@@ -503,20 +583,25 @@ checked_strdup(const char *s)
int
main(int argc, char **argv)
{
- int Aflag = 0, Rflag = 0, Lflag = 0, aflag = 0, vflag = 0;
+ int Aflag = 0, Mflag = 0, Rflag = 0, Lflag = 0, aflag = 0, vflag = 0;
const char *conf_path = DEFAULT_CONFIG_PATH;
- char *nickname = NULL, *discovery_host = NULL, *host = NULL,
+ char *nickname = NULL, *discovery_host = NULL, *portal = NULL,
*target = NULL, *user = NULL, *secret = NULL;
+ long long session_id = -1;
+ char *end;
int ch, error, iscsi_fd, retval, saved_errno;
int failed = 0;
struct conf *conf;
struct target *targ;
- while ((ch = getopt(argc, argv, "ARLac:d:n:p:t:u:s:v")) != -1) {
+ while ((ch = getopt(argc, argv, "AMRLac:d:i:n:p:t:u:s:v")) != -1) {
switch (ch) {
case 'A':
Aflag = 1;
break;
+ case 'M':
+ Mflag = 1;
+ break;
case 'R':
Rflag = 1;
break;
@@ -532,11 +617,21 @@ main(int argc, char **argv)
case 'd':
discovery_host = optarg;
break;
+ case 'i':
+ session_id = strtol(optarg, &end, 10);
+ if ((size_t)(end - optarg) != strlen(optarg))
+ errx(1, "trailing characters after session-id");
+ if (session_id < 0)
+ errx(1, "session-id cannot be negative");
+ if (session_id > UINT_MAX)
+ errx(1, "session-id cannot be greater than %u",
+ UINT_MAX);
+ break;
case 'n':
nickname = optarg;
break;
case 'p':
- host = optarg;
+ portal = optarg;
break;
case 't':
target = optarg;
@@ -559,10 +654,10 @@ main(int argc, char **argv)
if (argc != 0)
usage();
- if (Aflag + Rflag + Lflag == 0)
+ if (Aflag + Mflag + Rflag + Lflag == 0)
Lflag = 1;
- if (Aflag + Rflag + Lflag > 1)
- errx(1, "at most one of -A, -R, or -L may be specified");
+ if (Aflag + Mflag + Rflag + Lflag > 1)
+ errx(1, "at most one of -A, -M, -R, or -L may be specified");
/*
* Note that we ignore unneccessary/inapplicable "-c" flag; so that
@@ -571,7 +666,7 @@ main(int argc, char **argv)
*/
if (Aflag != 0) {
if (aflag != 0) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-a and -p and mutually exclusive");
if (target != NULL)
errx(1, "-a and -t and mutually exclusive");
@@ -584,7 +679,7 @@ main(int argc, char **argv)
if (discovery_host != NULL)
errx(1, "-a and -d and mutually exclusive");
} else if (nickname != NULL) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-n and -p and mutually exclusive");
if (target != NULL)
errx(1, "-n and -t and mutually exclusive");
@@ -595,17 +690,17 @@ main(int argc, char **argv)
if (discovery_host != NULL)
errx(1, "-n and -d and mutually exclusive");
} else if (discovery_host != NULL) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-d and -p and mutually exclusive");
if (target != NULL)
errx(1, "-d and -t and mutually exclusive");
} else {
- if (target == NULL && host == NULL)
+ if (target == NULL && portal == NULL)
errx(1, "must specify -a, -n or -t/-p");
- if (target != NULL && host == NULL)
+ if (target != NULL && portal == NULL)
errx(1, "-t must always be used with -p");
- if (host != NULL && target == NULL)
+ if (portal != NULL && target == NULL)
errx(1, "-p must always be used with -t");
}
@@ -614,9 +709,33 @@ main(int argc, char **argv)
if (secret != NULL && user == NULL)
errx(1, "-s must always be used with -u");
+ if (session_id != -1)
+ errx(1, "-i cannot be used with -A");
if (vflag != 0)
errx(1, "-v cannot be used with -A");
+ } else if (Mflag != 0) {
+ if (session_id == -1)
+ errx(1, "-M requires -i");
+
+ if (discovery_host != NULL)
+ errx(1, "-M and -d are mutually exclusive");
+ if (aflag != 0)
+ errx(1, "-M and -a are mutually exclusive");
+ if (nickname != NULL) {
+ if (portal != NULL)
+ errx(1, "-n and -p and mutually exclusive");
+ if (target != NULL)
+ errx(1, "-n and -t and mutually exclusive");
+ if (user != NULL)
+ errx(1, "-n and -u and mutually exclusive");
+ if (secret != NULL)
+ errx(1, "-n and -s and mutually exclusive");
+ }
+
+ if (vflag != 0)
+ errx(1, "-v cannot be used with -M");
+
} else if (Rflag != 0) {
if (user != NULL)
errx(1, "-R and -u are mutually exclusive");
@@ -626,33 +745,35 @@ main(int argc, char **argv)
errx(1, "-R and -d are mutually exclusive");
if (aflag != 0) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-a and -p and mutually exclusive");
if (target != NULL)
errx(1, "-a and -t and mutually exclusive");
if (nickname != NULL)
errx(1, "-a and -n and mutually exclusive");
} else if (nickname != NULL) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-n and -p and mutually exclusive");
if (target != NULL)
errx(1, "-n and -t and mutually exclusive");
- } else if (host != NULL) {
+ } else if (portal != NULL) {
if (target != NULL)
errx(1, "-p and -t and mutually exclusive");
} else if (target != NULL) {
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-t and -p and mutually exclusive");
} else
errx(1, "must specify either -a, -n, -t, or -p");
+ if (session_id != -1)
+ errx(1, "-i cannot be used with -R");
if (vflag != 0)
errx(1, "-v cannot be used with -R");
} else {
assert(Lflag != 0);
- if (host != NULL)
+ if (portal != NULL)
errx(1, "-L and -p and mutually exclusive");
if (target != NULL)
errx(1, "-L and -t and mutually exclusive");
@@ -664,6 +785,9 @@ main(int argc, char **argv)
errx(1, "-L and -n and mutually exclusive");
if (discovery_host != NULL)
errx(1, "-L and -d and mutually exclusive");
+
+ if (session_id != -1)
+ errx(1, "-i cannot be used with -L");
}
iscsi_fd = open(ISCSI_PATH, O_RDWR);
@@ -687,15 +811,20 @@ main(int argc, char **argv)
conf = conf_new_from_file(conf_path);
targ = target_find(conf, nickname);
if (targ == NULL)
- errx(1, "target %s not found in the configuration file",
- nickname);
+ errx(1, "target %s not found in %s",
+ nickname, conf_path);
if (Aflag != 0)
failed += kernel_add(iscsi_fd, targ);
+ else if (Mflag != 0)
+ failed += kernel_modify(iscsi_fd, session_id, targ);
else if (Rflag != 0)
failed += kernel_remove(iscsi_fd, targ);
else
failed += kernel_list(iscsi_fd, targ, vflag);
+ } else if (Mflag != 0) {
+ kernel_modify_some(iscsi_fd, session_id, target, portal,
+ user, secret);
} else {
if (Aflag != 0 && target != NULL) {
if (valid_iscsi_name(target) == false)
@@ -712,7 +841,7 @@ main(int argc, char **argv)
targ->t_address = discovery_host;
} else {
targ->t_session_type = SESSION_TYPE_NORMAL;
- targ->t_address = host;
+ targ->t_address = portal;
}
targ->t_user = user;
targ->t_secret = secret;
diff --git a/usr.bin/kdump/Makefile.depend b/usr.bin/kdump/Makefile.depend
index c7bcbb8..07c251c 100644
--- a/usr.bin/kdump/Makefile.depend
+++ b/usr.bin/kdump/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/ktrdump/ktrdump.8 b/usr.bin/ktrdump/ktrdump.8
index 9a77bfc..697e418 100644
--- a/usr.bin/ktrdump/ktrdump.8
+++ b/usr.bin/ktrdump/ktrdump.8
@@ -86,7 +86,7 @@ utility first appeared in
The
.Nm
utility was implemented by
-.An Jake Burkholder Aq jake@FreeBSD.org .
+.An Jake Burkholder Aq Mt jake@FreeBSD.org .
.Pp
This manual page was written by
-.An Chad David Aq davidc@FreeBSD.org .
+.An Chad David Aq Mt davidc@FreeBSD.org .
diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1
index b245631..483825b 100644
--- a/usr.bin/ldd/ldd.1
+++ b/usr.bin/ldd/ldd.1
@@ -77,4 +77,4 @@ utility first appeared in SunOS 4.0, it appeared in its current form in
The
.Fl v
support is based on code written by
-.An John Polstra Aq jdp@polstra.com
+.An John Polstra Aq Mt jdp@polstra.com
diff --git a/usr.bin/less/Makefile b/usr.bin/less/Makefile
index 3bfadfa..22147cd 100644
--- a/usr.bin/less/Makefile
+++ b/usr.bin/less/Makefile
@@ -8,8 +8,8 @@ SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c cvt.c \
signal.c tags.c ttyin.c version.c
SCRIPTS=lesspipe.sh zless.sh
SCRIPTSNAME_lesspipe.sh=lesspipe.sh
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
LINKS= ${BINDIR}/less ${BINDIR}/more \
${BINDIR}/zless ${BINDIR}/bzless \
${BINDIR}/zless ${BINDIR}/xzless \
diff --git a/usr.bin/less/Makefile.depend b/usr.bin/less/Makefile.depend
index 4f4df65..3a6e381 100644
--- a/usr.bin/less/Makefile.depend
+++ b/usr.bin/less/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
@@ -10,7 +11,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/lessecho/Makefile.depend b/usr.bin/lessecho/Makefile.depend
index 96aa2a2..09f98c1 100644
--- a/usr.bin/lessecho/Makefile.depend
+++ b/usr.bin/lessecho/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/lesskey/Makefile.depend b/usr.bin/lesskey/Makefile.depend
index 96aa2a2..09f98c1 100644
--- a/usr.bin/lesskey/Makefile.depend
+++ b/usr.bin/lesskey/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/lockf/lockf.1 b/usr.bin/lockf/lockf.1
index be9d9cc..57119e5 100644
--- a/usr.bin/lockf/lockf.1
+++ b/usr.bin/lockf/lockf.1
@@ -169,4 +169,4 @@ A
utility first appeared in
.Fx 2.2 .
.Sh AUTHORS
-.An John Polstra Aq jdp@polstra.com
+.An John Polstra Aq Mt jdp@polstra.com
diff --git a/usr.bin/logins/logins.1 b/usr.bin/logins/logins.1
index 6ac7acc..d84284a 100644
--- a/usr.bin/logins/logins.1
+++ b/usr.bin/logins/logins.1
@@ -100,5 +100,5 @@ utility appeared in
The
.Nm
utility was written by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org
based on similar utilities in other operating systems.
diff --git a/usr.bin/look/look.1 b/usr.bin/look/look.1
index e9498bb..e6f70bb 100644
--- a/usr.bin/look/look.1
+++ b/usr.bin/look/look.1
@@ -63,12 +63,12 @@ alphabetic characters is ignored.
.Pp
The following options are available:
.Bl -tag -width indent
-.It Fl d
+.It Fl d , -alphanum
Dictionary character set and order, i.e., only alphanumeric characters
are compared.
-.It Fl f
+.It Fl f , -ignore-case
Ignore the case of alphabetic characters.
-.It Fl t
+.It Fl t , -terminate Ar termchar
Specify a string termination character, i.e., only the characters
in
.Ar string
@@ -103,6 +103,12 @@ in comparisons when the
option was specified.
This was incorrect and the current man page matches the historic
implementation.
+.Pp
+The
+.Fl a
+and
+.Fl -alternative
+flags are ignored for compability.
.Sh SEE ALSO
.Xr grep 1 ,
.Xr sort 1
diff --git a/usr.bin/look/look.c b/usr.bin/look/look.c
index e77a216..ada6e25 100644
--- a/usr.bin/look/look.c
+++ b/usr.bin/look/look.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <getopt.h>
#include <limits.h>
#include <locale.h>
#include <stdint.h>
@@ -88,6 +89,14 @@ static void print_from(wchar_t *, unsigned char *, unsigned char *);
static void usage(void);
+static struct option longopts[] = {
+ { "alternative",no_argument, NULL, 'a' },
+ { "alphanum", no_argument, NULL, 'd' },
+ { "ignore-case",no_argument, NULL, 'i' },
+ { "terminate", required_argument, NULL, 't'},
+ { NULL, 0, NULL, 0 },
+};
+
int
main(int argc, char *argv[])
{
@@ -102,8 +111,11 @@ main(int argc, char *argv[])
file = _path_words;
termchar = L'\0';
- while ((ch = getopt(argc, argv, "dft:")) != -1)
+ while ((ch = getopt_long(argc, argv, "+adft:", longopts, NULL)) != -1)
switch(ch) {
+ case 'a':
+ /* COMPATIBILITY */
+ break;
case 'd':
dflag = 1;
break;
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
index 13b99c8..7691b2e 100644
--- a/usr.bin/m4/Makefile
+++ b/usr.bin/m4/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.10 2002/04/26 13:13:41 espie Exp $
+# $OpenBSD: Makefile,v 1.13 2014/05/12 19:11:19 espie Exp $
# $FreeBSD$
# -DEXTENDED
@@ -15,10 +15,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l
.PATH: ${.CURDIR}/lib
-SRCS+= ohash_create_entry.c ohash_delete.c ohash_do.c ohash_entries.c \
- ohash_enum.c ohash_init.c ohash_int.h ohash_interval.c \
- ohash_lookup_interval.c ohash_lookup_memory.c ohash_qlookup.c \
- ohash_qlookupi.c
+SRCS+= ohash.c
tokenizer.o: parser.h
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
index fbd42aa..b4b025e 100644
--- a/usr.bin/m4/eval.c
+++ b/usr.bin/m4/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.70 2012/04/12 17:00:11 espie Exp $ */
+/* $OpenBSD: eval.c,v 1.73 2014/07/11 21:04:17 espie Exp $ */
/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */
/*
@@ -267,7 +267,7 @@ expand_builtin(const char *argv[], int argc, int td)
doesyscmd(argv[2]);
break;
case INCLTYPE:
- if (argc > 2)
+ if (argc > 2) {
if (!doincl(argv[2])) {
if (mimic_gnu) {
warn("%s at line %lu: include(%s)",
@@ -277,6 +277,7 @@ expand_builtin(const char *argv[], int argc, int td)
err(1, "%s at line %lu: include(%s)",
CURRENT_NAME, CURRENT_LINE, argv[2]);
}
+ }
break;
case SINCTYPE:
@@ -794,7 +795,7 @@ dom4wrap(const char *text)
maxwraps = 16;
else
maxwraps *= 2;
- m4wraps = xrealloc(m4wraps, maxwraps * sizeof(*m4wraps),
+ m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps),
"too many m4wraps");
}
m4wraps[wrapindex++] = xstrdup(text);
@@ -821,11 +822,10 @@ dodiv(int n)
if (outfile[n] == NULL) {
char fname[] = _PATH_DIVNAME;
- if ((fd = mkstemp(fname)) < 0 ||
- (outfile[n] = fdopen(fd, "w+")) == NULL)
- err(1, "%s: cannot divert", fname);
- if (unlink(fname) == -1)
- err(1, "%s: cannot unlink", fname);
+ if ((fd = mkstemp(fname)) < 0 ||
+ unlink(fname) == -1 ||
+ (outfile[n] = fdopen(fd, "w+")) == NULL)
+ err(1, "%s: cannot divert", fname);
}
active = outfile[n];
}
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h
index 7753c32..fd2d3ae 100644
--- a/usr.bin/m4/extern.h
+++ b/usr.bin/m4/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.52 2012/04/12 17:00:11 espie Exp $ */
+/* $OpenBSD: extern.h,v 1.54 2014/05/12 19:11:19 espie Exp $ */
/* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */
/*-
@@ -104,8 +104,10 @@ extern void pbnumbase(int, int, int);
extern void pbunsigned(unsigned long);
extern void pbstr(const char *);
extern void pushback(int);
-extern void *xalloc(size_t, const char *fmt, ...);
-extern void *xrealloc(void *, size_t, const char *fmt, ...);
+extern void *xalloc(size_t, const char *, ...);
+extern void *xcalloc(size_t, size_t, const char *, ...);
+extern void *xrealloc(void *, size_t, const char *, ...);
+extern void *xreallocarray(void *, size_t, size_t, const char *, ...);
extern char *xstrdup(const char *);
extern void usage(void);
extern void resizedivs(int);
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c
index 342751a..cac01ec 100644
--- a/usr.bin/m4/gnum4.c
+++ b/usr.bin/m4/gnum4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gnum4.c,v 1.42 2011/11/06 12:25:43 espie Exp $ */
+/* $OpenBSD: gnum4.c,v 1.46 2014/07/10 14:12:31 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie
@@ -196,10 +196,12 @@ static void addchars(const char *, size_t);
static void addchar(int);
static char *twiddle(const char *);
static char *getstring(void);
-static void exit_regerror(int, regex_t *);
-static void do_subst(const char *, regex_t *, const char *, regmatch_t *);
-static void do_regexpindex(const char *, regex_t *, regmatch_t *);
-static void do_regexp(const char *, regex_t *, const char *, regmatch_t *);
+static void exit_regerror(int, regex_t *, const char *);
+static void do_subst(const char *, regex_t *, const char *, const char *,
+ regmatch_t *);
+static void do_regexpindex(const char *, regex_t *, const char *, regmatch_t *);
+static void do_regexp(const char *, regex_t *, const char *, const char *,
+ regmatch_t *);
static void add_sub(int, const char *, regex_t *, regmatch_t *);
static void add_replace(const char *, regex_t *, const char *, regmatch_t *);
#define addconstantstring(s) addchars((s), sizeof(s)-1)
@@ -243,7 +245,7 @@ getstring(void)
static void
-exit_regerror(int er, regex_t *re)
+exit_regerror(int er, regex_t *re, const char *source)
{
size_t errlen;
char *errbuf;
@@ -252,7 +254,7 @@ exit_regerror(int er, regex_t *re)
errbuf = xalloc(errlen,
"malloc in regerror: %lu", (unsigned long)errlen);
regerror(er, re, errbuf, errlen);
- m4errx(1, "regular expression error: %s.", errbuf);
+ m4errx(1, "regular expression error in %s: %s.", source, errbuf);
}
static void
@@ -296,7 +298,7 @@ add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm
p++;
continue;
}
- if (isdigit(p[1])) {
+ if (isdigit((unsigned char)p[1])) {
add_sub(*(++p) - '0', string, re, pm);
continue;
}
@@ -306,7 +308,8 @@ add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm
}
static void
-do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
+do_subst(const char *string, regex_t *re, const char *source,
+ const char *replace, regmatch_t *pm)
{
int error;
int flags = 0;
@@ -341,12 +344,13 @@ do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
string += pm[0].rm_eo;
}
if (error != REG_NOMATCH)
- exit_regerror(error, re);
+ exit_regerror(error, re, source);
pbstr(string);
}
static void
-do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
+do_regexp(const char *string, regex_t *re, const char *source,
+ const char *replace, regmatch_t *pm)
{
int error;
@@ -358,12 +362,13 @@ do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm)
case REG_NOMATCH:
break;
default:
- exit_regerror(error, re);
+ exit_regerror(error, re, source);
}
}
static void
-do_regexpindex(const char *string, regex_t *re, regmatch_t *pm)
+do_regexpindex(const char *string, regex_t *re, const char *source,
+ regmatch_t *pm)
{
int error;
@@ -375,7 +380,7 @@ do_regexpindex(const char *string, regex_t *re, regmatch_t *pm)
pbnum(-1);
break;
default:
- exit_regerror(error, re);
+ exit_regerror(error, re, source);
}
}
@@ -459,6 +464,7 @@ dopatsubst(const char *argv[], int argc)
regex_t re;
regmatch_t *pmatch;
int mode = REG_EXTENDED;
+ const char *source;
size_t l = strlen(argv[3]);
if (!mimic_gnu ||
@@ -466,13 +472,14 @@ dopatsubst(const char *argv[], int argc)
(l > 0 && argv[3][l-1] == '$'))
mode |= REG_NEWLINE;
- error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
- mode);
+ source = mimic_gnu ? twiddle(argv[3]) : argv[3];
+ error = regcomp(&re, source, mode);
if (error != 0)
- exit_regerror(error, &re);
+ exit_regerror(error, &re, source);
- pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL);
- do_subst(argv[2], &re,
+ pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t),
+ NULL);
+ do_subst(argv[2], &re, source,
argc > 4 && argv[4] != NULL ? argv[4] : "", pmatch);
free(pmatch);
regfree(&re);
@@ -486,6 +493,7 @@ doregexp(const char *argv[], int argc)
int error;
regex_t re;
regmatch_t *pmatch;
+ const char *source;
if (argc <= 3) {
warnx("Too few arguments to regexp");
@@ -498,16 +506,16 @@ doregexp(const char *argv[], int argc)
else
pbstr(argv[4]);
}
- error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
- REG_EXTENDED|REG_NEWLINE);
+ source = mimic_gnu ? twiddle(argv[3]) : argv[3];
+ error = regcomp(&re, source, REG_EXTENDED|REG_NEWLINE);
if (error != 0)
- exit_regerror(error, &re);
+ exit_regerror(error, &re, source);
- pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL);
+ pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), NULL);
if (argc == 4 || argv[4] == NULL)
- do_regexpindex(argv[2], &re, pmatch);
+ do_regexpindex(argv[2], &re, source, pmatch);
else
- do_regexp(argv[2], &re, argv[4], pmatch);
+ do_regexp(argv[2], &re, source, argv[4], pmatch);
free(pmatch);
regfree(&re);
}
diff --git a/usr.bin/m4/lib/ohash.c b/usr.bin/m4/lib/ohash.c
new file mode 100644
index 0000000..3a0f5dd
--- /dev/null
+++ b/usr.bin/m4/lib/ohash.c
@@ -0,0 +1,330 @@
+/* $OpenBSD: src/lib/libutil/ohash.c,v 1.1 2014/06/02 18:52:03 deraadt Exp $ */
+
+/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include "ohash.h"
+
+struct _ohash_record {
+ uint32_t hv;
+ const char *p;
+};
+
+#define DELETED ((const char *)h)
+#define NONE (h->size)
+
+/* Don't bother changing the hash table if the change is small enough. */
+#define MINSIZE (1UL << 4)
+#define MINDELETED 4
+
+static void ohash_resize(struct ohash *);
+
+
+/* This handles the common case of variable length keys, where the
+ * key is stored at the end of the record.
+ */
+void *
+ohash_create_entry(struct ohash_info *i, const char *start, const char **end)
+{
+ char *p;
+
+ if (!*end)
+ *end = start + strlen(start);
+ p = (i->alloc)(i->key_offset + (*end - start) + 1, i->data);
+ if (p) {
+ memcpy(p+i->key_offset, start, *end-start);
+ p[i->key_offset + (*end - start)] = '\0';
+ }
+ return (void *)p;
+}
+
+/* hash_delete only frees the hash structure. Use hash_first/hash_next
+ * to free entries as well. */
+void
+ohash_delete(struct ohash *h)
+{
+ (h->info.free)(h->t, h->info.data);
+#ifndef NDEBUG
+ h->t = NULL;
+#endif
+}
+
+static void
+ohash_resize(struct ohash *h)
+{
+ struct _ohash_record *n;
+ size_t ns;
+ unsigned int j;
+ unsigned int i, incr;
+
+ if (4 * h->deleted < h->total) {
+ if (h->size >= (UINT_MAX >> 1U))
+ ns = UINT_MAX;
+ else
+ ns = h->size << 1U;
+ } else if (3 * h->deleted > 2 * h->total)
+ ns = h->size >> 1U;
+ else
+ ns = h->size;
+ if (ns < MINSIZE)
+ ns = MINSIZE;
+#ifdef STATS_HASH
+ STAT_HASH_EXPAND++;
+ STAT_HASH_SIZE += ns - h->size;
+#endif
+
+ n = (h->info.calloc)(ns, sizeof(struct _ohash_record), h->info.data);
+ if (!n)
+ return;
+
+ for (j = 0; j < h->size; j++) {
+ if (h->t[j].p != NULL && h->t[j].p != DELETED) {
+ i = h->t[j].hv % ns;
+ incr = ((h->t[j].hv % (ns - 2)) & ~1) + 1;
+ while (n[i].p != NULL) {
+ i += incr;
+ if (i >= ns)
+ i -= ns;
+ }
+ n[i].hv = h->t[j].hv;
+ n[i].p = h->t[j].p;
+ }
+ }
+ (h->info.free)(h->t, h->info.data);
+ h->t = n;
+ h->size = ns;
+ h->total -= h->deleted;
+ h->deleted = 0;
+}
+
+void *
+ohash_remove(struct ohash *h, unsigned int i)
+{
+ void *result = (void *)h->t[i].p;
+
+ if (result == NULL || result == DELETED)
+ return NULL;
+
+#ifdef STATS_HASH
+ STAT_HASH_ENTRIES--;
+#endif
+ h->t[i].p = DELETED;
+ h->deleted++;
+ if (h->deleted >= MINDELETED && 4 * h->deleted > h->total)
+ ohash_resize(h);
+ return result;
+}
+
+void *
+ohash_find(struct ohash *h, unsigned int i)
+{
+ if (h->t[i].p == DELETED)
+ return NULL;
+ else
+ return (void *)h->t[i].p;
+}
+
+void *
+ohash_insert(struct ohash *h, unsigned int i, void *p)
+{
+#ifdef STATS_HASH
+ STAT_HASH_ENTRIES++;
+#endif
+ if (h->t[i].p == DELETED) {
+ h->deleted--;
+ h->t[i].p = p;
+ } else {
+ h->t[i].p = p;
+ /* Arbitrary resize boundary. Tweak if not efficient enough. */
+ if (++h->total * 4 > h->size * 3)
+ ohash_resize(h);
+ }
+ return p;
+}
+
+unsigned int
+ohash_entries(struct ohash *h)
+{
+ return h->total - h->deleted;
+}
+
+void *
+ohash_first(struct ohash *h, unsigned int *pos)
+{
+ *pos = 0;
+ return ohash_next(h, pos);
+}
+
+void *
+ohash_next(struct ohash *h, unsigned int *pos)
+{
+ for (; *pos < h->size; (*pos)++)
+ if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL)
+ return (void *)h->t[(*pos)++].p;
+ return NULL;
+}
+
+void
+ohash_init(struct ohash *h, unsigned int size, struct ohash_info *info)
+{
+ h->size = 1UL << size;
+ if (h->size < MINSIZE)
+ h->size = MINSIZE;
+#ifdef STATS_HASH
+ STAT_HASH_CREATION++;
+ STAT_HASH_SIZE += h->size;
+#endif
+ /* Copy info so that caller may free it. */
+ h->info.key_offset = info->key_offset;
+ h->info.calloc = info->calloc;
+ h->info.free = info->free;
+ h->info.alloc = info->alloc;
+ h->info.data = info->data;
+ h->t = (h->info.calloc)(h->size, sizeof(struct _ohash_record),
+ h->info.data);
+ h->total = h->deleted = 0;
+}
+
+uint32_t
+ohash_interval(const char *s, const char **e)
+{
+ uint32_t k;
+
+ if (!*e)
+ *e = s + strlen(s);
+ if (s == *e)
+ k = 0;
+ else
+ k = *s++;
+ while (s != *e)
+ k = ((k << 2) | (k >> 30)) ^ *s++;
+ return k;
+}
+
+unsigned int
+ohash_lookup_interval(struct ohash *h, const char *start, const char *end,
+ uint32_t hv)
+{
+ unsigned int i, incr;
+ unsigned int empty;
+
+#ifdef STATS_HASH
+ STAT_HASH_LOOKUP++;
+#endif
+ empty = NONE;
+ i = hv % h->size;
+ incr = ((hv % (h->size-2)) & ~1) + 1;
+ while (h->t[i].p != NULL) {
+#ifdef STATS_HASH
+ STAT_HASH_LENGTH++;
+#endif
+ if (h->t[i].p == DELETED) {
+ if (empty == NONE)
+ empty = i;
+ } else if (h->t[i].hv == hv &&
+ strncmp(h->t[i].p+h->info.key_offset, start,
+ end - start) == 0 &&
+ (h->t[i].p+h->info.key_offset)[end-start] == '\0') {
+ if (empty != NONE) {
+ h->t[empty].hv = hv;
+ h->t[empty].p = h->t[i].p;
+ h->t[i].p = DELETED;
+ return empty;
+ } else {
+#ifdef STATS_HASH
+ STAT_HASH_POSITIVE++;
+#endif
+ return i;
+ }
+ }
+ i += incr;
+ if (i >= h->size)
+ i -= h->size;
+ }
+
+ /* Found an empty position. */
+ if (empty != NONE)
+ i = empty;
+ h->t[i].hv = hv;
+ return i;
+}
+
+unsigned int
+ohash_lookup_memory(struct ohash *h, const char *k, size_t size, uint32_t hv)
+{
+ unsigned int i, incr;
+ unsigned int empty;
+
+#ifdef STATS_HASH
+ STAT_HASH_LOOKUP++;
+#endif
+ empty = NONE;
+ i = hv % h->size;
+ incr = ((hv % (h->size-2)) & ~1) + 1;
+ while (h->t[i].p != NULL) {
+#ifdef STATS_HASH
+ STAT_HASH_LENGTH++;
+#endif
+ if (h->t[i].p == DELETED) {
+ if (empty == NONE)
+ empty = i;
+ } else if (h->t[i].hv == hv &&
+ memcmp(h->t[i].p+h->info.key_offset, k, size) == 0) {
+ if (empty != NONE) {
+ h->t[empty].hv = hv;
+ h->t[empty].p = h->t[i].p;
+ h->t[i].p = DELETED;
+ return empty;
+ } else {
+#ifdef STATS_HASH
+ STAT_HASH_POSITIVE++;
+#endif
+ } return i;
+ }
+ i += incr;
+ if (i >= h->size)
+ i -= h->size;
+ }
+
+ /* Found an empty position. */
+ if (empty != NONE)
+ i = empty;
+ h->t[i].hv = hv;
+ return i;
+}
+
+unsigned int
+ohash_qlookup(struct ohash *h, const char *s)
+{
+ const char *e = NULL;
+ return ohash_qlookupi(h, s, &e);
+}
+
+unsigned int
+ohash_qlookupi(struct ohash *h, const char *s, const char **e)
+{
+ uint32_t hv;
+
+ hv = ohash_interval(s, e);
+ return ohash_lookup_interval(h, s, *e, hv);
+}
diff --git a/usr.bin/m4/lib/ohash.h b/usr.bin/m4/lib/ohash.h
index 9880102..698f02e 100644
--- a/usr.bin/m4/lib/ohash.h
+++ b/usr.bin/m4/lib/ohash.h
@@ -1,8 +1,4 @@
-#ifndef OHASH_H
-#define OHASH_H
-/* $OpenBSD: ohash.h,v 1.8 2005/12/29 18:54:47 jaredy Exp $ */
-/* ex:ts=8 sw=4:
- */
+/* $OpenBSD: src/lib/libutil/ohash.h,v 1.2 2014/06/02 18:52:03 deraadt Exp $ */
/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
*
@@ -21,21 +17,26 @@
* $FreeBSD$
*/
+#ifndef OHASH_H
+#define OHASH_H
+
/* Open hashing support.
* Open hashing was chosen because it is much lighter than other hash
* techniques, and more efficient in most cases.
*/
+/* user-visible data structure */
struct ohash_info {
ptrdiff_t key_offset;
void *data; /* user data */
- void *(*halloc)(size_t, void *);
- void (*hfree)(void *, size_t, void *);
+ void *(*calloc)(size_t, size_t, void *);
+ void (*free)(void *, void *);
void *(*alloc)(size_t, void *);
};
struct _ohash_record;
+/* private structure. It's there just so you can do a sizeof */
struct ohash {
struct _ohash_record *t;
struct ohash_info info;
@@ -55,9 +56,10 @@ void ohash_init(struct ohash *, unsigned, struct ohash_info *);
void ohash_delete(struct ohash *);
unsigned int ohash_lookup_interval(struct ohash *, const char *,
- const char *, u_int32_t);
+ const char *, uint32_t);
unsigned int ohash_lookup_memory(struct ohash *, const char *,
- size_t, u_int32_t);
+ size_t, uint32_t)
+ __attribute__ ((__bounded__(__string__,2,3)));
void *ohash_find(struct ohash *, unsigned int);
void *ohash_remove(struct ohash *, unsigned int);
void *ohash_insert(struct ohash *, unsigned int, void *);
@@ -66,10 +68,9 @@ void *ohash_next(struct ohash *, unsigned int *);
unsigned int ohash_entries(struct ohash *);
void *ohash_create_entry(struct ohash_info *, const char *, const char **);
-u_int32_t ohash_interval(const char *, const char **);
+uint32_t ohash_interval(const char *, const char **);
unsigned int ohash_qlookupi(struct ohash *, const char *, const char **);
unsigned int ohash_qlookup(struct ohash *, const char *);
__END_DECLS
#endif
-
diff --git a/usr.bin/m4/lib/ohash_create_entry.c b/usr.bin/m4/lib/ohash_create_entry.c
deleted file mode 100644
index b0959dd..0000000
--- a/usr.bin/m4/lib/ohash_create_entry.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: ohash_create_entry.c,v 1.2 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-/* This handles the common case of variable length keys, where the
- * key is stored at the end of the record.
- */
-void *
-ohash_create_entry(struct ohash_info *i, const char *start, const char **end)
-{
- char *p;
-
- if (!*end)
- *end = start + strlen(start);
- p = (i->alloc)(i->key_offset + (*end - start) + 1, i->data);
- if (p) {
- memcpy(p+i->key_offset, start, *end-start);
- p[i->key_offset + (*end - start)] = '\0';
- }
- return (void *)p;
-}
diff --git a/usr.bin/m4/lib/ohash_delete.c b/usr.bin/m4/lib/ohash_delete.c
deleted file mode 100644
index b0ec7b5..0000000
--- a/usr.bin/m4/lib/ohash_delete.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: ohash_delete.c,v 1.2 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-/* hash_delete only frees the hash structure. Use hash_first/hash_next
- * to free entries as well. */
-void
-ohash_delete(struct ohash *h)
-{
- (h->info.hfree)(h->t, sizeof(struct _ohash_record) * h->size,
- h->info.data);
-#ifndef NDEBUG
- h->t = NULL;
-#endif
-}
diff --git a/usr.bin/m4/lib/ohash_do.c b/usr.bin/m4/lib/ohash_do.c
deleted file mode 100644
index dffe6b6..0000000
--- a/usr.bin/m4/lib/ohash_do.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: ohash_do.c,v 1.4 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-static void ohash_resize(struct ohash *);
-
-static void
-ohash_resize(struct ohash *h)
-{
- struct _ohash_record *n;
- unsigned int ns, j;
- unsigned int i, incr;
-
- if (4 * h->deleted < h->total)
- ns = h->size << 1;
- else if (3 * h->deleted > 2 * h->total)
- ns = h->size >> 1;
- else
- ns = h->size;
- if (ns < MINSIZE)
- ns = MINSIZE;
-#ifdef STATS_HASH
- STAT_HASH_EXPAND++;
- STAT_HASH_SIZE += ns - h->size;
-#endif
- n = (h->info.halloc)(sizeof(struct _ohash_record) * ns, h->info.data);
- if (!n)
- return;
-
- for (j = 0; j < h->size; j++) {
- if (h->t[j].p != NULL && h->t[j].p != DELETED) {
- i = h->t[j].hv % ns;
- incr = ((h->t[j].hv % (ns - 2)) & ~1) + 1;
- while (n[i].p != NULL) {
- i += incr;
- if (i >= ns)
- i -= ns;
- }
- n[i].hv = h->t[j].hv;
- n[i].p = h->t[j].p;
- }
- }
- (h->info.hfree)(h->t, sizeof(struct _ohash_record) * h->size,
- h->info.data);
- h->t = n;
- h->size = ns;
- h->total -= h->deleted;
- h->deleted = 0;
-}
-
-void *
-ohash_remove(struct ohash *h, unsigned int i)
-{
- void *result = __DECONST(void *, h->t[i].p);
-
- if (result == NULL || result == DELETED)
- return NULL;
-
-#ifdef STATS_HASH
- STAT_HASH_ENTRIES--;
-#endif
- h->t[i].p = DELETED;
- h->deleted++;
- if (h->deleted >= MINDELETED && 4 * h->deleted > h->total)
- ohash_resize(h);
- return result;
-}
-
-void *
-ohash_find(struct ohash *h, unsigned int i)
-{
- if (h->t[i].p == DELETED)
- return NULL;
- else
- return __DECONST(void *, h->t[i].p);
-}
-
-void *
-ohash_insert(struct ohash *h, unsigned int i, void *p)
-{
-#ifdef STATS_HASH
- STAT_HASH_ENTRIES++;
-#endif
- if (h->t[i].p == DELETED) {
- h->deleted--;
- h->t[i].p = p;
- } else {
- h->t[i].p = p;
- /* Arbitrary resize boundary. Tweak if not efficient enough. */
- if (++h->total * 4 > h->size * 3)
- ohash_resize(h);
- }
- return p;
-}
diff --git a/usr.bin/m4/lib/ohash_entries.c b/usr.bin/m4/lib/ohash_entries.c
deleted file mode 100644
index c6c5d3e..0000000
--- a/usr.bin/m4/lib/ohash_entries.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: ohash_entries.c,v 1.2 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-unsigned int
-ohash_entries(struct ohash *h)
-{
- return h->total - h->deleted;
-}
diff --git a/usr.bin/m4/lib/ohash_enum.c b/usr.bin/m4/lib/ohash_enum.c
deleted file mode 100644
index 85a3bbc..0000000
--- a/usr.bin/m4/lib/ohash_enum.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: ohash_enum.c,v 1.3 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-void *
-ohash_first(struct ohash *h, unsigned int *pos)
-{
- *pos = 0;
- return ohash_next(h, pos);
-}
-
-void *
-ohash_next(struct ohash *h, unsigned int *pos)
-{
- for (; *pos < h->size; (*pos)++)
- if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL)
- return __DECONST(void *, h->t[(*pos)++].p);
- return NULL;
-}
diff --git a/usr.bin/m4/lib/ohash_init.3 b/usr.bin/m4/lib/ohash_init.3
index e0b2320..56ece40 100644
--- a/usr.bin/m4/lib/ohash_init.3
+++ b/usr.bin/m4/lib/ohash_init.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ohash_init.3,v 1.14 2007/05/31 19:19:30 jmc Exp $
+.\" $OpenBSD: ohash_init.3,v 1.2 2014/05/13 14:01:41 jmc Exp $
.\" Copyright (c) 1999 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
@@ -15,8 +15,8 @@
.\"
.\" $FreeBSD$
.\"
-.Dd $Mdocdate: May 31 2007 $
-.Dt OPEN_HASH 3
+.Dd May 12 2014
+.Dt OHASH_INIT 3
.Os
.Sh NAME
.Nm ohash_init ,
@@ -71,11 +71,46 @@ initializes the table to store roughly 2 to the power
.Fa size
elements.
.Fa info
-holds the position of the key in each record, and two pointers to
+is a pointer to a
+.Fa struct ohash_info .
+.Bd -literal -offset indent
+struct ohash_info {
+ ptrdiff_t key_offset;
+ void *data; /* user data */
+ void *(*calloc)(size_t, size_t, void *);
+ void (*free)(void *, void *);
+ void *(*alloc)(size_t, void *);
+};
+.Ed
+.Pp
+The
+.Va offset
+field holds the position of the key in each record;
+the
+.Va calloc
+and
+.Va free
+fields are pointers to
.Xr calloc 3
and
.Xr free 3 Ns -like
-functions, to use for managing the table internal storage.
+functions, used for managing the table internal storage;
+the
+.Va alloc
+field is only used by the utility function
+.Xr ohash_create_entry 3 .
+.Pp
+Each of these functions are called similarly to their standard counterpart,
+but with an extra
+.Ft void *
+parameter corresponding to the content of the field
+.Fa data ,
+which can be used to communicate specific information to the functions.
+.Pp
+.Fn ohash_init
+stores a copy of those fields internally, so
+.Fa info
+can be reclaimed after initialization.
.Pp
.Fn ohash_delete
frees storage internal to
@@ -166,7 +201,7 @@ for (n = ohash_first(h, &i); n != NULL; n = ohash_next(h, &i))
points to an auxiliary unsigned integer used to record the current position
in the ohash table.
Those functions are safe to use even while entries are added to/removed
-from the table, but in such a case they do not guarantee that new entries
+from the table, but in such a case they don't guarantee that new entries
will be returned.
As a special case, they can safely be used to free elements in the table.
.Pp
@@ -179,7 +214,13 @@ Only
.Fn ohash_remove
and
.Fn ohash_delete
-may call the user-supplied memory functions.
+may call the user-supplied memory functions:
+.Bd -literal -offset indent
+p = (*info->calloc)(n, sizeof_record, info->data);
+/* copy data from old to p */
+(*info->free)(old, info->data);
+.Ed
+.Pp
It is the responsibility of the user memory allocation code to verify
that those calls did not fail.
.Pp
@@ -213,6 +254,7 @@ call.
.Pp
Multi-threaded applications should explicitly protect ohash table access.
.Sh SEE ALSO
+.Xr hcreate 3 ,
.Xr ohash_interval 3
.Rs
.%A Donald E. Knuth
diff --git a/usr.bin/m4/lib/ohash_init.c b/usr.bin/m4/lib/ohash_init.c
deleted file mode 100644
index a98673d..0000000
--- a/usr.bin/m4/lib/ohash_init.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: ohash_init.c,v 1.2 2004/06/22 20:00:16 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-void
-ohash_init(struct ohash *h, unsigned int size, struct ohash_info *info)
-{
- h->size = 1UL << size;
- if (h->size < MINSIZE)
- h->size = MINSIZE;
-#ifdef STATS_HASH
- STAT_HASH_CREATION++;
- STAT_HASH_SIZE += h->size;
-#endif
- /* Copy info so that caller may free it. */
- h->info.key_offset = info->key_offset;
- h->info.halloc = info->halloc;
- h->info.hfree = info->hfree;
- h->info.alloc = info->alloc;
- h->info.data = info->data;
- h->t = (h->info.halloc)(sizeof(struct _ohash_record) * h->size,
- h->info.data);
- h->total = h->deleted = 0;
-}
diff --git a/usr.bin/m4/lib/ohash_int.h b/usr.bin/m4/lib/ohash_int.h
deleted file mode 100644
index 49e01a4..0000000
--- a/usr.bin/m4/lib/ohash_int.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $OpenBSD: ohash_int.h,v 1.3 2006/01/16 15:52:25 espie Exp $ */
-/* $FreeBSD$ */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include "ohash.h"
-
-struct _ohash_record {
- u_int32_t hv;
- const char *p;
-};
-
-#define DELETED ((const char *)h)
-#define NONE (h->size)
-
-/* Don't bother changing the hash table if the change is small enough. */
-#define MINSIZE (1UL << 4)
-#define MINDELETED 4
diff --git a/usr.bin/m4/lib/ohash_interval.3 b/usr.bin/m4/lib/ohash_interval.3
index 8abe7a8..3a930f5 100644
--- a/usr.bin/m4/lib/ohash_interval.3
+++ b/usr.bin/m4/lib/ohash_interval.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ohash_interval.3,v 1.11 2007/05/31 19:19:30 jmc Exp $
+.\" $OpenBSD: ohash_interval.3,v 1.1 2014/05/12 19:09:00 espie Exp $
.\" Copyright (c) 2001 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
@@ -15,8 +15,8 @@
.\"
.\" $FreeBSD$
.\"
-.Dd $Mdocdate: May 31 2007 $
-.Dt OPEN_HASH_HELPER 3
+.Dd June 5 2013
+.Dt OHASH_INTERVAL 3
.Os
.Sh NAME
.Nm ohash_interval ,
@@ -68,7 +68,10 @@ the alloc field of
.Fa info
should point to a
.Xr malloc 3 Ns -like
-function to allocate the storage.
+function to allocate the storage:
+.Bd -literal -offset indent
+p = (*info->alloc)(sz, info->data);
+.Ed
.Pp
.Fn ohash_qlookupi
is a wrapper function that simply calls
diff --git a/usr.bin/m4/lib/ohash_interval.c b/usr.bin/m4/lib/ohash_interval.c
deleted file mode 100644
index f6884c0..0000000
--- a/usr.bin/m4/lib/ohash_interval.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: ohash_interval.c,v 1.3 2006/01/16 15:52:25 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-uint32_t
-ohash_interval(const char *s, const char **e)
-{
- uint32_t k;
-
- if (!*e)
- *e = s + strlen(s);
- if (s == *e)
- k = 0;
- else
- k = *s++;
- while (s != *e)
- k = ((k << 2) | (k >> 30)) ^ *s++;
- return k;
-}
diff --git a/usr.bin/m4/lib/ohash_lookup_interval.c b/usr.bin/m4/lib/ohash_lookup_interval.c
deleted file mode 100644
index 196f5fa..0000000
--- a/usr.bin/m4/lib/ohash_lookup_interval.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: ohash_lookup_interval.c,v 1.3 2006/01/16 15:52:25 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-unsigned int
-ohash_lookup_interval(struct ohash *h, const char *start, const char *end,
- uint32_t hv)
-{
- unsigned int i, incr;
- unsigned int empty;
-
-#ifdef STATS_HASH
- STAT_HASH_LOOKUP++;
-#endif
- empty = NONE;
- i = hv % h->size;
- incr = ((hv % (h->size-2)) & ~1) + 1;
- while (h->t[i].p != NULL) {
-#ifdef STATS_HASH
- STAT_HASH_LENGTH++;
-#endif
- if (h->t[i].p == DELETED) {
- if (empty == NONE)
- empty = i;
- } else if (h->t[i].hv == hv &&
- strncmp(h->t[i].p+h->info.key_offset, start,
- end - start) == 0 &&
- (h->t[i].p+h->info.key_offset)[end-start] == '\0') {
- if (empty != NONE) {
- h->t[empty].hv = hv;
- h->t[empty].p = h->t[i].p;
- h->t[i].p = DELETED;
- return empty;
- } else {
-#ifdef STATS_HASH
- STAT_HASH_POSITIVE++;
-#endif
- return i;
- }
- }
- i += incr;
- if (i >= h->size)
- i -= h->size;
- }
-
- /* Found an empty position. */
- if (empty != NONE)
- i = empty;
- h->t[i].hv = hv;
- return i;
-}
diff --git a/usr.bin/m4/lib/ohash_lookup_memory.c b/usr.bin/m4/lib/ohash_lookup_memory.c
deleted file mode 100644
index 0c448e0..0000000
--- a/usr.bin/m4/lib/ohash_lookup_memory.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: ohash_lookup_memory.c,v 1.3 2006/01/16 15:52:25 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-unsigned int
-ohash_lookup_memory(struct ohash *h, const char *k, size_t size, uint32_t hv)
-{
- unsigned int i, incr;
- unsigned int empty;
-
-#ifdef STATS_HASH
- STAT_HASH_LOOKUP++;
-#endif
- empty = NONE;
- i = hv % h->size;
- incr = ((hv % (h->size-2)) & ~1) + 1;
- while (h->t[i].p != NULL) {
-#ifdef STATS_HASH
- STAT_HASH_LENGTH++;
-#endif
- if (h->t[i].p == DELETED) {
- if (empty == NONE)
- empty = i;
- } else if (h->t[i].hv == hv &&
- memcmp(h->t[i].p+h->info.key_offset, k, size) == 0) {
- if (empty != NONE) {
- h->t[empty].hv = hv;
- h->t[empty].p = h->t[i].p;
- h->t[i].p = DELETED;
- return empty;
- } else {
-#ifdef STATS_HASH
- STAT_HASH_POSITIVE++;
-#endif
- } return i;
- }
- i += incr;
- if (i >= h->size)
- i -= h->size;
- }
-
- /* Found an empty position. */
- if (empty != NONE)
- i = empty;
- h->t[i].hv = hv;
- return i;
-}
diff --git a/usr.bin/m4/lib/ohash_qlookup.c b/usr.bin/m4/lib/ohash_qlookup.c
deleted file mode 100644
index 81e7d55..0000000
--- a/usr.bin/m4/lib/ohash_qlookup.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $OpenBSD: ohash_qlookup.c,v 1.2 2004/06/22 20:00:17 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-unsigned int
-ohash_qlookup(struct ohash *h, const char *s)
-{
- const char *e = NULL;
- return ohash_qlookupi(h, s, &e);
-}
diff --git a/usr.bin/m4/lib/ohash_qlookupi.c b/usr.bin/m4/lib/ohash_qlookupi.c
deleted file mode 100644
index ab90fe3..0000000
--- a/usr.bin/m4/lib/ohash_qlookupi.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: ohash_qlookupi.c,v 1.2 2004/06/22 20:00:17 espie Exp $ */
-/* ex:ts=8 sw=4:
- */
-
-/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "ohash_int.h"
-
-unsigned int
-ohash_qlookupi(struct ohash *h, const char *s, const char **e)
-{
- u_int32_t hv;
-
- hv = ohash_interval(s, e);
- return ohash_lookup_interval(h, s, *e, hv);
-}
diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c
index 904c055..70497e0 100644
--- a/usr.bin/m4/look.c
+++ b/usr.bin/m4/look.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: look.c,v 1.22 2010/09/07 19:58:09 marco Exp $ */
+/* $OpenBSD: look.c,v 1.23 2014/05/12 19:11:19 espie Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -51,36 +51,34 @@ __FBSDID("$FreeBSD$");
#include "stdd.h"
#include "extern.h"
-static void *hash_alloc(size_t, void *);
-static void hash_free(void *, size_t, void *);
+static void *hash_calloc(size_t, size_t, void *);
+static void hash_free(void *, void *);
static void *element_alloc(size_t, void *);
static void setup_definition(struct macro_definition *, const char *,
const char *);
static struct ohash_info macro_info = {
offsetof(struct ndblock, name),
- NULL, hash_alloc, hash_free, element_alloc };
+ NULL, hash_calloc, hash_free, element_alloc };
struct ohash macros;
/* Support routines for hash tables. */
void *
-hash_alloc(size_t s, __unused void *u)
+hash_calloc(size_t n, size_t s, void *u __unused)
{
- void *storage = xalloc(s, "hash alloc");
- if (storage)
- memset(storage, 0, s);
+ void *storage = xcalloc(n, s, "hash alloc");
return storage;
}
void
-hash_free(void *p, __unused size_t s, __unused void *u)
+hash_free(void *p, void *u __unused)
{
free(p);
}
void *
-element_alloc(size_t s, __unused void *u)
+element_alloc(size_t s, void *u __unused)
{
return xalloc(s, "element alloc");
}
diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1
index d0669c1..c72ffac 100644
--- a/usr.bin/m4/m4.1
+++ b/usr.bin/m4/m4.1
@@ -1,5 +1,5 @@
.\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $
-.\" @(#) $OpenBSD: m4.1,v 1.59 2010/10/21 13:20:51 jmc Exp $
+.\" @(#) $OpenBSD: m4.1,v 1.62 2014/04/14 07:00:47 jmc Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 21, 2010
+.Dd January 12 2014 $
.Dt M4 1
.Os
.Sh NAME
@@ -88,9 +88,7 @@ In arguments to macros, leading unquoted space, tab, and newline
.Pq Sq \en
characters are ignored.
To quote strings, use left and right single quotes
-.Po e.g.,\ \&
-.Sq "\ this is a string with a leading space"
-.Pc .
+.Pq e.g., Sq \ \&this is a string with a leading space .
You can change the quote characters with the
.Ic changequote
built-in macro.
@@ -258,15 +256,17 @@ Prints the first argument on the standard error output stream.
Passes its first argument to a shell and returns the shell's standard output.
Note that the shell shares its standard input and standard error with
.Nm .
-.It Fn eval expr
+.It Fn eval expr[,radix[,minimum]]
Computes the first argument as an arithmetic expression using 32-bit
arithmetic.
Operators are the standard C ternary, arithmetic, logical,
shift, relational, bitwise, and parentheses operators.
You can specify
octal, decimal, and hexadecimal numbers as in C.
-The second argument (if any)
-specifies the radix for the result and the third argument (if any)
+The optional second argument
+.Fa radix
+specifies the radix for the result and the optional third argument
+.Fa minimum
specifies the minimum number of digits in the result.
.It Fn expr expr
This is an alias for
@@ -441,12 +441,12 @@ macro can modify the exit status.
.Sh STANDARDS
The
.Nm
-utility is mostly compliant with the
+utility is compliant with the
.St -p1003.1-2008
specification.
.Pp
The flags
-.Op Fl dgIot
+.Op Fl dgIPot
and the macros
.Ic builtin ,
.Ic esyscmd ,
@@ -467,9 +467,13 @@ are extensions to that specification.
is not supposed to be a synonym for
.Ic mkstemp ,
but instead to be an insecure temporary file name creation function.
-The change causes no known compatibility issues.
+It is marked by
+.St -p1003.1-2008
+as being obsolescent and should not be used if portability is a concern.
.Pp
-The output format of tracing and of
+The output format of
+.Ic traceon
+and
.Ic dumpdef
are not specified in any standard,
are likely to change and should not be relied upon.
@@ -500,9 +504,9 @@ Many other
have dire size limitations with respect to buffer sizes.
.Sh AUTHORS
.An -nosplit
-.An Ozan Yigit Aq oz@sis.yorku.ca
+.An Ozan Yigit Aq Mt oz@sis.yorku.ca
and
-.An Richard A. O'Keefe Aq ok@goanna.cs.rmit.OZ.AU .
+.An Richard A. O'Keefe Aq Mt ok@goanna.cs.rmit.OZ.AU .
.Pp
GNU-m4 compatibility extensions by
-.An Marc Espie Aq espie@cvs.openbsd.org .
+.An Marc Espie Aq Mt espie@cvs.openbsd.org .
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c
index 1cb0340..ced881b 100644
--- a/usr.bin/m4/main.c
+++ b/usr.bin/m4/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.81 2012/04/12 17:00:11 espie Exp $ */
+/* $OpenBSD: main.c,v 1.83 2014/05/12 19:11:19 espie Exp $ */
/* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */
/*-
@@ -180,8 +180,8 @@ main(int argc, char *argv[])
initspaces();
STACKMAX = INITSTACKMAX;
- mstack = (stae *)xalloc(sizeof(stae) * STACKMAX, NULL);
- sstack = (char *)xalloc(STACKMAX, NULL);
+ mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL);
+ sstack = xalloc(STACKMAX, NULL);
maxout = 0;
outfile = NULL;
@@ -415,7 +415,8 @@ macro(void)
}
}
} else if (t == EOF) {
- if (sp > -1 && ilevel <= 0) {
+ if (!mimic_gnu /* you can puke right there */
+ && sp > -1 && ilevel <= 0) {
warnx( "unexpected end of input, unclosed parenthesis:");
dump_stack(paren, PARLEV);
exit(1);
@@ -625,7 +626,7 @@ static void
enlarge_stack(void)
{
STACKMAX += STACKMAX/2;
- mstack = xrealloc(mstack, sizeof(stae) * STACKMAX,
+ mstack = xreallocarray(mstack, STACKMAX, sizeof(stae),
"Evaluation stack overflow (%lu)",
(unsigned long)STACKMAX);
sstack = xrealloc(sstack, STACKMAX,
diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c
index c5bcfbf..ebf0198 100644
--- a/usr.bin/m4/misc.c
+++ b/usr.bin/m4/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.42 2010/09/07 19:58:09 marco Exp $ */
+/* $OpenBSD: misc.c,v 1.44 2014/05/12 19:11:19 espie Exp $ */
/* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */
/*
@@ -32,6 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -165,7 +167,7 @@ initspaces(void)
strspace = xalloc(strsize+1, NULL);
ep = strspace;
endest = strspace+strsize;
- buf = (unsigned char *)xalloc(bufsize, NULL);
+ buf = xalloc(bufsize, NULL);
bufbase = buf;
bp = buf;
endpbb = buf + bufsize;
@@ -239,7 +241,7 @@ getdiv(int n)
}
void
-onintr(__unused int signo)
+onintr(int signo __unused)
{
#define intrmessage "m4: interrupted.\n"
write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1);
@@ -263,7 +265,7 @@ killdiv(void)
extern char *__progname;
void
-m4errx(int evaluation, const char *fmt, ...)
+m4errx(int eval, const char *fmt, ...)
{
fprintf(stderr, "%s: ", __progname);
fprintf(stderr, "%s at line %lu: ", CURRENT_NAME, CURRENT_LINE);
@@ -275,7 +277,7 @@ m4errx(int evaluation, const char *fmt, ...)
va_end(ap);
}
fprintf(stderr, "\n");
- exit(evaluation);
+ exit(eval);
}
/*
@@ -285,7 +287,7 @@ resizedivs(int n)
{
int i;
- outfile = (FILE **)xrealloc(outfile, sizeof(FILE *) * n,
+ outfile = xreallocarray(outfile, n, sizeof(FILE *),
"too many diverts %d", n);
for (i = maxout; i < n; i++)
outfile[i] = NULL;
@@ -312,6 +314,25 @@ xalloc(size_t n, const char *fmt, ...)
}
void *
+xcalloc(size_t n, size_t s, const char *fmt, ...)
+{
+ void *p = calloc(n, s);
+
+ if (p == NULL) {
+ if (fmt == NULL)
+ err(1, "calloc");
+ else {
+ va_list va;
+
+ va_start(va, fmt);
+ verr(1, fmt, va);
+ va_end(va);
+ }
+ }
+ return p;
+}
+
+void *
xrealloc(void *old, size_t n, const char *fmt, ...)
{
char *p = realloc(old, n);
@@ -331,6 +352,43 @@ xrealloc(void *old, size_t n, const char *fmt, ...)
return p;
}
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4))
+
+static void *
+reallocarray(void *optr, size_t nmemb, size_t size)
+{
+ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ nmemb > 0 && SIZE_MAX / nmemb < size) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ return realloc(optr, size * nmemb);
+}
+
+void *
+xreallocarray(void *old, size_t s1, size_t s2, const char *fmt, ...)
+{
+ void *p = reallocarray(old, s1, s2);
+
+ if (p == NULL) {
+ free(old);
+ if (fmt == NULL)
+ err(1, "reallocarray");
+ else {
+ va_list va;
+
+ va_start(va, fmt);
+ verr(1, fmt, va);
+ va_end(va);
+ }
+ }
+ return p;
+}
+
char *
xstrdup(const char *s)
{
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index bd9d58d..bfdeca0 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -113,11 +113,8 @@ CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
# if we are here we don't want this called 'make'
PROG= fmake
+CLEANFILES+= fmake.1
fmake.1: make.1
cp ${.ALLSRC} ${.TARGET}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.bin/make/tests/syntax/directive-t0/Makefile b/usr.bin/make/tests/syntax/directive-t0/Makefile
deleted file mode 100644
index 6d557e2..0000000
--- a/usr.bin/make/tests/syntax/directive-t0/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-
-TESTSDIR= ${TESTSBASE}/usr.bin/make/syntax/directive-t0
-
-TAP_TESTS_SH= legacy_test
-
-FILESDIR= ${TESTSDIR}
-FILES= Makefile.test
-FILES+= expected.status.1
-FILES+= expected.stderr.1
-FILES+= expected.stdout.1
-
-.include <bsd.test.mk>
diff --git a/usr.bin/make/tests/variables/modifier_M/Makefile b/usr.bin/make/tests/variables/modifier_M/Makefile
deleted file mode 100644
index 59cb0bc..0000000
--- a/usr.bin/make/tests/variables/modifier_M/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-
-TESTSDIR= ${TESTSBASE}/usr.bin/make/variables/modifier_M
-
-TAP_TESTS_SH= legacy_test
-
-FILESDIR= ${TESTSDIR}
-FILES= Makefile.test
-FILES+= expected.status.1
-FILES+= expected.stderr.1
-FILES+= expected.stdout.1
-
-.include <bsd.test.mk>
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
index ed88f4e..eb50978 100644
--- a/usr.bin/mandoc/Makefile
+++ b/usr.bin/mandoc/Makefile
@@ -19,4 +19,6 @@ CFLAGS+= -DHAVE_CONFIG_H
DPADD= ${LIBMANDOC}
LDADD= ${LIBMANDOC}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/mesg/mesg.c b/usr.bin/mesg/mesg.c
index 270c1c5..796a047 100644
--- a/usr.bin/mesg/mesg.c
+++ b/usr.bin/mesg/mesg.c
@@ -15,11 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/usr.bin/mkcsmapper/mkcsmapper.1 b/usr.bin/mkcsmapper/mkcsmapper.1
index 650df50..cf1fde2 100644
--- a/usr.bin/mkcsmapper/mkcsmapper.1
+++ b/usr.bin/mkcsmapper/mkcsmapper.1
@@ -86,4 +86,4 @@ first appeared in
.Fx 9.0 .
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/usr.bin/mkesdb/mkesdb.1 b/usr.bin/mkesdb/mkesdb.1
index 66eb390..c5d2edf 100644
--- a/usr.bin/mkesdb/mkesdb.1
+++ b/usr.bin/mkesdb/mkesdb.1
@@ -81,4 +81,4 @@ first appeared in
.Fx 9.0 .
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile
index 491e582..b802799 100644
--- a/usr.bin/mkimg/Makefile
+++ b/usr.bin/mkimg/Makefile
@@ -1,11 +1,17 @@
# $FreeBSD$
PROG= mkimg
-SRCS= mkimg.c scheme.c
+SRCS= format.c image.c mkimg.c scheme.c
MAN= mkimg.1
CFLAGS+=-DSPARSE_WRITE
+# List of formats to support
+SRCS+= \
+ raw.c \
+ vhd.c \
+ vmdk.c
+
# List of schemes to support
SRCS+= \
apm.c \
diff --git a/usr.bin/mkimg/apm.c b/usr.bin/mkimg/apm.c
index 36d6ab8..12add8e 100644
--- a/usr.bin/mkimg/apm.c
+++ b/usr.bin/mkimg/apm.c
@@ -35,9 +35,13 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
+#ifndef APM_ENT_TYPE_APPLE_BOOT
+#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap"
+#endif
#ifndef APM_ENT_TYPE_FREEBSD_NANDFS
#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs"
#endif
@@ -63,7 +67,7 @@ apm_metadata(u_int where)
}
static int
-apm_write(int fd, lba_t imgsz, void *bootcode __unused)
+apm_write(lba_t imgsz, void *bootcode __unused)
{
u_char *buf;
struct apm_ddr *ddr;
@@ -85,8 +89,8 @@ apm_write(int fd, lba_t imgsz, void *bootcode __unused)
be32enc(&ent->ent_pmblkcnt, nparts + 1);
be32enc(&ent->ent_start, 1);
be32enc(&ent->ent_size, nparts + 1);
- strcpy(ent->ent_type, APM_ENT_TYPE_SELF);
- strcpy(ent->ent_name, "Apple");
+ strncpy(ent->ent_type, APM_ENT_TYPE_SELF, sizeof(ent->ent_type));
+ strncpy(ent->ent_name, "Apple", sizeof(ent->ent_name));
STAILQ_FOREACH(part, &partlist, link) {
ent = (void *)(buf + (part->index + 2) * secsz);
@@ -94,12 +98,14 @@ apm_write(int fd, lba_t imgsz, void *bootcode __unused)
be32enc(&ent->ent_pmblkcnt, nparts + 1);
be32enc(&ent->ent_start, part->block);
be32enc(&ent->ent_size, part->size);
- strcpy(ent->ent_type, ALIAS_TYPE2PTR(part->type));
+ strncpy(ent->ent_type, ALIAS_TYPE2PTR(part->type),
+ sizeof(ent->ent_type));
if (part->label != NULL)
- strcpy(ent->ent_name, part->label);
+ strncpy(ent->ent_name, part->label,
+ sizeof(ent->ent_name));
}
- error = mkimg_write(fd, 0, buf, nparts + 2);
+ error = image_write(0, buf, nparts + 2);
free(buf);
return (error);
}
diff --git a/usr.bin/mkimg/bsd.c b/usr.bin/mkimg/bsd.c
index df99130..03af5cd 100644
--- a/usr.bin/mkimg/bsd.c
+++ b/usr.bin/mkimg/bsd.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -61,7 +62,7 @@ bsd_metadata(u_int where)
}
static int
-bsd_write(int fd, lba_t imgsz, void *bootcode)
+bsd_write(lba_t imgsz, void *bootcode)
{
u_char *buf, *p;
struct disklabel *d;
@@ -79,8 +80,12 @@ bsd_write(int fd, lba_t imgsz, void *bootcode)
} else
memset(buf, 0, BBSIZE);
- imgsz = ncyls * nheads * nsecs;
- ftruncate(fd, imgsz * secsz);
+ imgsz = (lba_t)ncyls * nheads * nsecs;
+ error = image_set_size(imgsz);
+ if (error) {
+ free(buf);
+ return (error);
+ }
d = (void *)(buf + secsz);
le32enc(&d->d_magic, DISKMAGIC);
@@ -111,7 +116,7 @@ bsd_write(int fd, lba_t imgsz, void *bootcode)
checksum ^= le16dec(p);
le16enc(&d->d_checksum, checksum);
- error = mkimg_write(fd, 0, buf, BBSIZE / secsz);
+ error = image_write(0, buf, BBSIZE / secsz);
free(buf);
return (error);
}
diff --git a/usr.bin/mkimg/ebr.c b/usr.bin/mkimg/ebr.c
index 372dbbd..77204d7 100644
--- a/usr.bin/mkimg/ebr.c
+++ b/usr.bin/mkimg/ebr.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -67,7 +68,7 @@ ebr_chs(u_char *cyl, u_char *hd, u_char *sec, uint32_t lba __unused)
}
static int
-ebr_write(int fd, lba_t imgsz __unused, void *bootcode __unused)
+ebr_write(lba_t imgsz __unused, void *bootcode __unused)
{
u_char *ebr;
struct dos_partition *dp;
@@ -104,7 +105,7 @@ ebr_write(int fd, lba_t imgsz __unused, void *bootcode __unused)
le32enc(&dp->dp_size, next->size + nsecs);
}
- error = mkimg_write(fd, block, ebr, 1);
+ error = image_write(block, ebr, 1);
if (error)
break;
diff --git a/usr.bin/mkimg/format.c b/usr.bin/mkimg/format.c
new file mode 100644
index 0000000..57bbd98
--- /dev/null
+++ b/usr.bin/mkimg/format.c
@@ -0,0 +1,91 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/linker_set.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <err.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+
+static struct mkimg_format *format;
+
+int
+format_resize(lba_t end)
+{
+
+ if (format == NULL)
+ return (ENOSYS);
+ return (format->resize(end));
+}
+
+int
+format_select(const char *spec)
+{
+ struct mkimg_format *f, **iter;
+
+ SET_FOREACH(iter, formats) {
+ f = *iter;
+ if (strcasecmp(spec, f->name) == 0) {
+ format = f;
+ return (0);
+ }
+ }
+ return (EINVAL);
+}
+
+struct mkimg_format *
+format_selected(void)
+{
+
+ return (format);
+}
+
+int
+format_write(int fd)
+{
+ lba_t size;
+ int error;
+
+ if (format == NULL)
+ return (ENOSYS);
+ size = image_get_size();
+ error = format->resize(size);
+ if (!error)
+ error = format->write(fd);
+ return (error);
+}
diff --git a/usr.bin/mkimg/format.h b/usr.bin/mkimg/format.h
new file mode 100644
index 0000000..aa00e6e
--- /dev/null
+++ b/usr.bin/mkimg/format.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MKIMG_FORMAT_H_
+#define _MKIMG_FORMAT_H_
+
+#include <sys/linker_set.h>
+
+struct mkimg_format {
+ const char *name;
+ const char *description;
+ int (*resize)(lba_t);
+ int (*write)(int);
+};
+
+SET_DECLARE(formats, struct mkimg_format);
+#define FORMAT_DEFINE(nm) DATA_SET(formats, nm)
+
+int format_resize(lba_t);
+int format_select(const char *);
+struct mkimg_format *format_selected(void);
+int format_write(int);
+
+#endif /* _MKIMG_FORMAT_H_ */
diff --git a/usr.bin/mkimg/gpt.c b/usr.bin/mkimg/gpt.c
index 5385228..959deb3 100644
--- a/usr.bin/mkimg/gpt.c
+++ b/usr.bin/mkimg/gpt.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <uuid.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -166,7 +167,7 @@ gpt_metadata(u_int where)
}
static int
-gpt_write_pmbr(int fd, lba_t blks, void *bootcode)
+gpt_write_pmbr(lba_t blks, void *bootcode)
{
u_char *pmbr;
uint32_t secs;
@@ -190,7 +191,7 @@ gpt_write_pmbr(int fd, lba_t blks, void *bootcode)
le32enc(pmbr + DOSPARTOFF + 8, 1);
le32enc(pmbr + DOSPARTOFF + 12, secs);
le16enc(pmbr + DOSMAGICOFFSET, DOSMAGIC);
- error = mkimg_write(fd, 0, pmbr, 1);
+ error = image_write(0, pmbr, 1);
free(pmbr);
return (error);
}
@@ -210,7 +211,7 @@ gpt_mktbl(u_int tblsz)
STAILQ_FOREACH(part, &partlist, link) {
ent = tbl + part->index;
gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type));
- uuidgen(&uuid, 1);
+ mkimg_uuid(&uuid);
gpt_uuid_enc(&ent->ent_uuid, &uuid);
le64enc(&ent->ent_lba_start, part->block);
le64enc(&ent->ent_lba_end, part->block + part->size - 1);
@@ -226,8 +227,7 @@ gpt_mktbl(u_int tblsz)
}
static int
-gpt_write_hdr(int fd, struct gpt_hdr *hdr, uint64_t self, uint64_t alt,
- uint64_t tbl)
+gpt_write_hdr(struct gpt_hdr *hdr, uint64_t self, uint64_t alt, uint64_t tbl)
{
uint32_t crc;
@@ -237,11 +237,11 @@ gpt_write_hdr(int fd, struct gpt_hdr *hdr, uint64_t self, uint64_t alt,
hdr->hdr_crc_self = 0;
crc = crc32(hdr, offsetof(struct gpt_hdr, padding));
le64enc(&hdr->hdr_crc_self, crc);
- return (mkimg_write(fd, self, hdr, 1));
+ return (image_write(self, hdr, 1));
}
static int
-gpt_write(int fd, lba_t imgsz, void *bootcode)
+gpt_write(lba_t imgsz, void *bootcode)
{
uuid_t uuid;
struct gpt_ent *tbl;
@@ -251,7 +251,7 @@ gpt_write(int fd, lba_t imgsz, void *bootcode)
int error;
/* PMBR */
- error = gpt_write_pmbr(fd, imgsz, bootcode);
+ error = gpt_write_pmbr(imgsz, bootcode);
if (error)
return (error);
@@ -260,10 +260,10 @@ gpt_write(int fd, lba_t imgsz, void *bootcode)
tbl = gpt_mktbl(tblsz);
if (tbl == NULL)
return (errno);
- error = mkimg_write(fd, 2, tbl, tblsz);
+ error = image_write(2, tbl, tblsz);
if (error)
goto out;
- error = mkimg_write(fd, imgsz - (tblsz + 1), tbl, tblsz);
+ error = image_write(imgsz - (tblsz + 1), tbl, tblsz);
if (error)
goto out;
@@ -279,15 +279,15 @@ gpt_write(int fd, lba_t imgsz, void *bootcode)
le32enc(&hdr->hdr_size, offsetof(struct gpt_hdr, padding));
le64enc(&hdr->hdr_lba_start, 2 + tblsz);
le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2);
- uuidgen(&uuid, 1);
+ mkimg_uuid(&uuid);
gpt_uuid_enc(&hdr->hdr_uuid, &uuid);
le32enc(&hdr->hdr_entries, nparts);
le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent));
crc = crc32(tbl, nparts * sizeof(struct gpt_ent));
le32enc(&hdr->hdr_crc_table, crc);
- error = gpt_write_hdr(fd, hdr, 1, imgsz - 1, 2);
+ error = gpt_write_hdr(hdr, 1, imgsz - 1, 2);
if (!error)
- error = gpt_write_hdr(fd, hdr, imgsz - 1, 1, imgsz - tblsz - 1);
+ error = gpt_write_hdr(hdr, imgsz - 1, 1, imgsz - tblsz - 1);
free(hdr);
out:
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c
new file mode 100644
index 0000000..f448d98
--- /dev/null
+++ b/usr.bin/mkimg/image.c
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "mkimg.h"
+
+#define BUFFER_SIZE (1024*1024)
+
+static char image_tmpfile[PATH_MAX];
+static int image_fd = -1;
+static lba_t image_size;
+
+static void
+cleanup(void)
+{
+
+ if (image_fd != -1)
+ close(image_fd);
+ unlink(image_tmpfile);
+}
+
+int
+image_copyin(lba_t blk, int fd, uint64_t *sizep)
+{
+ char *buffer;
+ uint64_t bytesize;
+ ssize_t bcnt, rdsz;
+ int error, partial;
+
+ assert(BUFFER_SIZE % secsz == 0);
+
+ buffer = malloc(BUFFER_SIZE);
+ if (buffer == NULL)
+ return (ENOMEM);
+ bytesize = 0;
+ partial = 0;
+ while (1) {
+ rdsz = read(fd, buffer, BUFFER_SIZE);
+ if (rdsz <= 0) {
+ error = (rdsz < 0) ? errno : 0;
+ break;
+ }
+ if (partial)
+ abort();
+ bytesize += rdsz;
+ bcnt = (rdsz + secsz - 1) / secsz;
+ error = image_write(blk, buffer, bcnt);
+ if (error)
+ break;
+ blk += bcnt;
+ partial = ((ssize_t)(bcnt * secsz) != rdsz) ? 1 : 0;
+ }
+ free(buffer);
+ if (sizep != NULL)
+ *sizep = bytesize;
+ return (error);
+}
+
+int
+image_copyout(int fd)
+{
+ int error;
+
+ error = image_copyout_region(fd, 0, image_size);
+ if (!error)
+ error = image_copyout_done(fd);
+ return (error);
+}
+
+int
+image_copyout_done(int fd)
+{
+ off_t ofs;
+ int error;
+
+ ofs = lseek(fd, 0L, SEEK_CUR);
+ if (ofs == -1)
+ return (0);
+ error = (ftruncate(fd, ofs) == -1) ? errno : 0;
+ return (error);
+}
+
+int
+image_copyout_region(int fd, lba_t blk, lba_t size)
+{
+ char *buffer;
+ off_t ofs;
+ size_t sz;
+ ssize_t rdsz, wrsz;
+ int error;
+
+ ofs = lseek(fd, 0L, SEEK_CUR);
+
+ blk *= secsz;
+ if (lseek(image_fd, blk, SEEK_SET) != blk)
+ return (errno);
+ buffer = malloc(BUFFER_SIZE);
+ if (buffer == NULL)
+ return (errno);
+ error = 0;
+ size *= secsz;
+ while (size > 0) {
+ sz = (BUFFER_SIZE < size) ? BUFFER_SIZE : size;
+ rdsz = read(image_fd, buffer, sz);
+ if (rdsz <= 0) {
+ error = (rdsz < 0) ? errno : 0;
+ break;
+ }
+ wrsz = (ofs == -1) ?
+ write(fd, buffer, rdsz) :
+ sparse_write(fd, buffer, rdsz);
+ if (wrsz < 0) {
+ error = errno;
+ break;
+ }
+ assert(wrsz == rdsz);
+ size -= rdsz;
+ }
+ free(buffer);
+ return (error);
+}
+
+int
+image_data(lba_t blk, lba_t size)
+{
+ char *buffer, *p;
+
+ blk *= secsz;
+ if (lseek(image_fd, blk, SEEK_SET) != blk)
+ return (1);
+
+ size *= secsz;
+ buffer = malloc(size);
+ if (buffer == NULL)
+ return (1);
+
+ if (read(image_fd, buffer, size) != (ssize_t)size) {
+ free(buffer);
+ return (1);
+ }
+
+ p = buffer;
+ while (size > 0 && *p == '\0')
+ size--, p++;
+
+ free(buffer);
+ return ((size == 0) ? 0 : 1);
+}
+
+lba_t
+image_get_size(void)
+{
+
+ return (image_size);
+}
+
+int
+image_set_size(lba_t blk)
+{
+
+ image_size = blk;
+ if (ftruncate(image_fd, blk * secsz) == -1)
+ return (errno);
+ return (0);
+}
+
+int
+image_write(lba_t blk, void *buf, ssize_t len)
+{
+
+ blk *= secsz;
+ if (lseek(image_fd, blk, SEEK_SET) != blk)
+ return (errno);
+ len *= secsz;
+ if (sparse_write(image_fd, buf, len) != len)
+ return (errno);
+ return (0);
+}
+
+int
+image_init(void)
+{
+ const char *tmpdir;
+
+ if (atexit(cleanup) == -1)
+ return (errno);
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+ snprintf(image_tmpfile, sizeof(image_tmpfile), "%s/mkimg-XXXXXX",
+ tmpdir);
+ image_fd = mkstemp(image_tmpfile);
+ if (image_fd == -1)
+ return (errno);
+ return (0);
+}
diff --git a/usr.bin/mkimg/image.h b/usr.bin/mkimg/image.h
new file mode 100644
index 0000000..ce195d9
--- /dev/null
+++ b/usr.bin/mkimg/image.h
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MKIMG_IMAGE_H_
+#define _MKIMG_IMAGE_H_
+
+typedef int64_t lba_t;
+
+int image_copyin(lba_t blk, int fd, uint64_t *sizep);
+int image_copyout(int fd);
+int image_copyout_done(int fd);
+int image_copyout_region(int fd, lba_t blk, lba_t size);
+int image_data(lba_t blk, lba_t size);
+lba_t image_get_size(void);
+int image_init(void);
+int image_set_size(lba_t blk);
+int image_write(lba_t blk, void *buf, ssize_t len);
+
+#endif /* _MKIMG_IMAGE_H_ */
diff --git a/usr.bin/mkimg/mbr.c b/usr.bin/mkimg/mbr.c
index 0f89057..4b0f242 100644
--- a/usr.bin/mkimg/mbr.c
+++ b/usr.bin/mkimg/mbr.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -68,7 +69,7 @@ mbr_chs(u_char *cyl, u_char *hd, u_char *sec, uint32_t lba __unused)
}
static int
-mbr_write(int fd, lba_t imgsz __unused, void *bootcode)
+mbr_write(lba_t imgsz __unused, void *bootcode)
{
u_char *mbr;
struct dos_partition *dpbase, *dp;
@@ -96,7 +97,7 @@ mbr_write(int fd, lba_t imgsz __unused, void *bootcode)
le32enc(&dp->dp_start, part->block);
le32enc(&dp->dp_size, part->size);
}
- error = mkimg_write(fd, 0, mbr, 1);
+ error = image_write(0, mbr, 1);
free(mbr);
return (error);
}
diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1
index 4505fac..ed14cc8 100644
--- a/usr.bin/mkimg/mkimg.1
+++ b/usr.bin/mkimg/mkimg.1
@@ -24,12 +24,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 27, 2014
+.Dd July 4, 2014
.Dt MKIMG 1
.Os
.Sh NAME
.Nm mkimg
-.Nd "utility to make a disk image"
+.Nd "utility to make disk images"
.Sh SYNOPSIS
.Nm
.Op Fl H Ar heads
@@ -37,8 +37,10 @@
.Op Fl S Ar secsz
.Op Fl T Ar tracksz
.Op Fl b Ar bootcode
+.Op Fl f Ar format
.Op Fl o Ar outfile
.Op Fl v
+.Op Fl y
.Fl s Ar scheme
.Fl p Ar partition
.Op Fl p Ar partition ...
@@ -56,6 +58,10 @@ The disk image is written to
by default or the file specified with the
.Ar outfile
argument.
+The image file is a raw disk image by default, but the format of the
+image file can be specified with the
+.Ar format
+argument.
.Pp
The disk image can be made bootable by specifying the scheme-specific boot
block contents with the
@@ -106,10 +112,26 @@ option increases the level of output that the
.Nm
utility prints.
.Pp
-For a complete list of supported partitioning schemes or for a detailed
-description of how to specify partitions, run the
+The
+.Op Fl y
+option is used for testing purposes only and is not to be used in production.
+When present, the
+.Nm
+utility will generate predictable values for Universally Unique Identifiers
+(UUIDs) and time stamps so that consecutive runs of the
+.Nm
+utility will create images that are identical.
+.Pp
+For a complete list of supported partitioning schemes or supported output
+format, or for a detailed description of how to specify partitions, run the
.Nm
utility without any arguments.
+.Sh ENVIRONMENT
+.Bl -tag -width "TMPDIR" -compact
+.It Ev TMPDIR
+Directory to put temporary files in; default is
+.Pa /tmp .
+.El
.Sh EXAMPLES
To create a bootable disk image that is partitioned using the GPT scheme and
containing a root file system that was previously created using
@@ -121,6 +143,14 @@ utility as follows:
-p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G \
-o gpt.img
.Pp
+The command line given above results in a raw image file.
+This is because no output format was given.
+To create a VMDK image for example, add the
+.Fl f Ar vmdk
+argument to the
+.Nm
+utility and name the output file accordingly.
+.Pp
A nested partitioning scheme is created by running the
.Nm
utility twice.
@@ -154,8 +184,8 @@ In the following example the file system partition is labeled as 'backup':
.Sh HISTORY
The
.Nm
-utility appeared in
-.Fx 11.0
+utility first appeared in
+.Fx 10.1 .
.Sh AUTHORS
The
.Nm
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
index e767471..4513e66 100644
--- a/usr.bin/mkimg/mkimg.c
+++ b/usr.bin/mkimg/mkimg.c
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/uuid.h>
#include <errno.h>
#include <err.h>
#include <fcntl.h>
@@ -42,18 +43,15 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <unistd.h>
+#include "image.h"
+#include "format.h"
#include "mkimg.h"
#include "scheme.h"
-#if !defined(SPARSE_WRITE)
-#define sparse_write write
-#endif
-
-#define BUFFER_SIZE (1024*1024)
-
struct partlisthead partlist = STAILQ_HEAD_INITIALIZER(partlist);
u_int nparts = 0;
+u_int unit_testing;
u_int verbose;
u_int ncyls = 0;
@@ -62,46 +60,41 @@ u_int nsecs = 1;
u_int secsz = 512;
u_int blksz = 0;
-static int bcfd = -1;
-static int outfd = 0;
-static int tmpfd = -1;
-
-static char tmpfname[] = "/tmp/mkimg-XXXXXX";
-
-static void
-cleanup(void)
-{
-
- if (tmpfd != -1)
- close(tmpfd);
- unlink(tmpfname);
-}
-
static void
usage(const char *why)
{
- struct mkimg_scheme *s, **iter;
+ struct mkimg_format *f, **f_iter;
+ struct mkimg_scheme *s, **s_iter;
warnx("error: %s", why);
fprintf(stderr, "\nusage: %s <options>\n", getprogname());
fprintf(stderr, " options:\n");
fprintf(stderr, "\t-b <file>\t- file containing boot code\n");
+ fprintf(stderr, "\t-f <format>\n");
fprintf(stderr, "\t-o <file>\t- file to write image into\n");
fprintf(stderr, "\t-p <partition>\n");
fprintf(stderr, "\t-s <scheme>\n");
+ fprintf(stderr, "\t-v\t\t- increase verbosity\n");
+ fprintf(stderr, "\t-y\t\t- [developers] enable unit test\n");
fprintf(stderr, "\t-H <num>\t- number of heads to simulate\n");
fprintf(stderr, "\t-P <num>\t- physical sector size\n");
fprintf(stderr, "\t-S <num>\t- logical sector size\n");
fprintf(stderr, "\t-T <num>\t- number of tracks to simulate\n");
- fprintf(stderr, " schemes:\n");
- SET_FOREACH(iter, schemes) {
- s = *iter;
+ fprintf(stderr, "\n formats:\n");
+ SET_FOREACH(f_iter, formats) {
+ f = *f_iter;
+ fprintf(stderr, "\t%s\t- %s\n", f->name, f->description);
+ }
+
+ fprintf(stderr, "\n schemes:\n");
+ SET_FOREACH(s_iter, schemes) {
+ s = *s_iter;
fprintf(stderr, "\t%s\t- %s\n", s->name, s->description);
}
- fprintf(stderr, " partition specification:\n");
+ fprintf(stderr, "\n partition specification:\n");
fprintf(stderr, "\t<t>[/<l>]::<size>\t- empty partition of given "
"size\n");
fprintf(stderr, "\t<t>[/<l>]:=<file>\t- partition content and size "
@@ -228,14 +221,15 @@ parse_part(const char *spec)
}
#if defined(SPARSE_WRITE)
-static ssize_t
-sparse_write(int fd, const char *buf, size_t sz)
+ssize_t
+sparse_write(int fd, const void *ptr, size_t sz)
{
- const char *p;
+ const char *buf, *p;
off_t ofs;
size_t len;
ssize_t wr, wrsz;
+ buf = ptr;
wrsz = 0;
p = memchr(buf, 0, sz);
while (sz > 0) {
@@ -268,66 +262,24 @@ sparse_write(int fd, const char *buf, size_t sz)
}
#endif /* SPARSE_WRITE */
-static int
-fdcopy(int src, int dst, uint64_t *count)
+void
+mkimg_uuid(struct uuid *uuid)
{
- char *buffer;
- off_t ofs;
- ssize_t rdsz, wrsz;
+ static uint8_t gen[sizeof(struct uuid)];
+ u_int i;
- /* A return value of -1 means that we can't write a sparse file. */
- ofs = lseek(dst, 0L, SEEK_CUR);
-
- if (count != NULL)
- *count = 0;
-
- buffer = malloc(BUFFER_SIZE);
- if (buffer == NULL)
- return (errno);
- while (1) {
- rdsz = read(src, buffer, BUFFER_SIZE);
- if (rdsz <= 0) {
- free(buffer);
- return ((rdsz < 0) ? errno : 0);
- }
- if (count != NULL)
- *count += rdsz;
- wrsz = (ofs == -1) ?
- write(dst, buffer, rdsz) :
- sparse_write(dst, buffer, rdsz);
- if (wrsz < 0)
- break;
+ if (!unit_testing) {
+ uuidgen(uuid, 1);
+ return;
}
- free(buffer);
- return (errno);
-}
-static int
-mkimg_seek(int fd, lba_t blk)
-{
- off_t off;
-
- off = blk * secsz;
- if (lseek(fd, off, SEEK_SET) != off)
- return (errno);
- return (0);
-}
-
-int
-mkimg_write(int fd, lba_t blk, void *buf, ssize_t len)
-{
-
- blk *= secsz;
- if (lseek(fd, blk, SEEK_SET) != blk)
- return (errno);
- len *= secsz;
- if (write(fd, buf, len) != len)
- return (errno);
- return (0);
+ for (i = 0; i < sizeof(gen); i++)
+ gen[i]++;
+ memcpy(uuid, gen, sizeof(uuid_t));
}
static void
-mkimg(int bfd)
+mkimg(void)
{
FILE *fp;
struct part *part;
@@ -335,10 +287,6 @@ mkimg(int bfd)
off_t bytesize;
int error, fd;
- error = scheme_bootcode(bfd);
- if (error)
- errc(EX_DATAERR, error, "boot code");
-
/* First check partition information */
STAILQ_FOREACH(part, &partlist, link) {
error = scheme_check_part(part);
@@ -353,7 +301,6 @@ mkimg(int bfd)
fprintf(stderr, "partition %d: starting block %llu "
"... ", part->index + 1, (long long)block);
part->block = block;
- error = mkimg_seek(tmpfd, block);
switch (part->kind) {
case PART_KIND_SIZE:
if (expand_number(part->contents, &bytesize) == -1)
@@ -362,7 +309,7 @@ mkimg(int bfd)
case PART_KIND_FILE:
fd = open(part->contents, O_RDONLY, 0);
if (fd != -1) {
- error = fdcopy(fd, tmpfd, &bytesize);
+ error = image_copyin(block, fd, &bytesize);
close(fd);
} else
error = errno;
@@ -370,7 +317,8 @@ mkimg(int bfd)
case PART_KIND_PIPE:
fp = popen(part->contents, "r");
if (fp != NULL) {
- error = fdcopy(fileno(fp), tmpfd, &bytesize);
+ fd = fileno(fp);
+ error = image_copyin(block, fd, &bytesize);
pclose(fp);
} else
error = errno;
@@ -389,15 +337,27 @@ mkimg(int bfd)
}
block = scheme_metadata(SCHEME_META_IMG_END, block);
- error = (scheme_write(tmpfd, block));
+ error = image_set_size(block);
+ if (!error)
+ error = format_resize(block);
+ if (error)
+ errc(EX_IOERR, error, "image sizing");
+ block = image_get_size();
+ ncyls = block / (nsecs * nheads);
+ error = (scheme_write(block));
+ if (error)
+ errc(EX_IOERR, error, "writing metadata");
}
int
main(int argc, char *argv[])
{
+ int bcfd, outfd;
int c, error;
- while ((c = getopt(argc, argv, "b:o:p:s:vH:P:S:T:")) != -1) {
+ bcfd = -1;
+ outfd = 1; /* Write to stdout by default */
+ while ((c = getopt(argc, argv, "b:f:o:p:s:vyH:P:S:T:")) != -1) {
switch (c) {
case 'b': /* BOOT CODE */
if (bcfd != -1)
@@ -406,8 +366,15 @@ main(int argc, char *argv[])
if (bcfd == -1)
err(EX_UNAVAILABLE, "%s", optarg);
break;
+ case 'f': /* OUTPUT FORMAT */
+ if (format_selected() != NULL)
+ usage("multiple formats given");
+ error = format_select(optarg);
+ if (error)
+ errc(EX_DATAERR, error, "format");
+ break;
case 'o': /* OUTPUT FILE */
- if (outfd != 0)
+ if (outfd != 1)
usage("multiple output files given");
outfd = open(optarg, O_WRONLY | O_CREAT | O_TRUNC,
S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
@@ -426,6 +393,9 @@ main(int argc, char *argv[])
if (error)
errc(EX_DATAERR, error, "scheme");
break;
+ case 'y':
+ unit_testing++;
+ break;
case 'v':
verbose++;
break;
@@ -480,35 +450,43 @@ main(int argc, char *argv[])
errx(EX_DATAERR, "%d partitions supported; %d given",
scheme_max_parts(), nparts);
- if (outfd == 0) {
- if (atexit(cleanup) == -1)
- err(EX_OSERR, "cannot register cleanup function");
- outfd = 1;
- tmpfd = mkstemp(tmpfname);
- if (tmpfd == -1)
- err(EX_OSERR, "cannot create temporary file");
- } else
- tmpfd = outfd;
+ if (format_selected() == NULL)
+ format_select("raw");
+
+ if (bcfd != -1) {
+ error = scheme_bootcode(bcfd);
+ close(bcfd);
+ if (error)
+ errc(EX_DATAERR, error, "boot code");
+ }
if (verbose) {
fprintf(stderr, "Logical sector size: %u\n", secsz);
fprintf(stderr, "Physical block size: %u\n", blksz);
fprintf(stderr, "Sectors per track: %u\n", nsecs);
fprintf(stderr, "Number of heads: %u\n", nheads);
+ fputc('\n', stderr);
+ fprintf(stderr, "Partitioning scheme: %s\n",
+ scheme_selected()->name);
+ fprintf(stderr, "Output file format: %s\n",
+ format_selected()->name);
+ fputc('\n', stderr);
}
- mkimg(bcfd);
+ error = image_init();
+ if (error)
+ errc(EX_OSERR, error, "cannot initialize");
+
+ mkimg();
- if (verbose)
+ if (verbose) {
+ fputc('\n', stderr);
fprintf(stderr, "Number of cylinders: %u\n", ncyls);
-
- if (tmpfd != outfd) {
- error = mkimg_seek(tmpfd, 0);
- if (error == 0)
- error = fdcopy(tmpfd, outfd, NULL);
- if (error)
- errc(EX_IOERR, error, "writing to stdout");
}
+ error = format_write(outfd);
+ if (error)
+ errc(EX_IOERR, error, "writing image");
+
return (0);
}
diff --git a/usr.bin/mkimg/mkimg.h b/usr.bin/mkimg/mkimg.h
index 3be345d..9558b86 100644
--- a/usr.bin/mkimg/mkimg.h
+++ b/usr.bin/mkimg/mkimg.h
@@ -31,8 +31,6 @@
#include <sys/queue.h>
-typedef int64_t lba_t;
-
struct part {
STAILQ_ENTRY(part) link;
char *alias; /* Partition type alias. */
@@ -52,6 +50,7 @@ struct part {
extern STAILQ_HEAD(partlisthead, part) partlist;
extern u_int nparts;
+extern u_int unit_testing;
extern u_int verbose;
extern u_int ncyls;
@@ -67,6 +66,13 @@ round_block(lba_t n)
return ((n + b - 1) & ~(b - 1));
}
-int mkimg_write(int fd, lba_t blk, void *buf, ssize_t len);
+#if !defined(SPARSE_WRITE)
+#define sparse_write write
+#else
+ssize_t sparse_write(int, const void *, size_t);
+#endif
+
+struct uuid;
+void mkimg_uuid(struct uuid *);
#endif /* _MKIMG_MKIMG_H_ */
diff --git a/usr.bin/mkimg/pc98.c b/usr.bin/mkimg/pc98.c
index 7eb0a8e..24b9156 100644
--- a/usr.bin/mkimg/pc98.c
+++ b/usr.bin/mkimg/pc98.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -77,7 +78,7 @@ pc98_chs(u_short *cyl, u_char *hd, u_char *sec, uint32_t lba __unused)
}
static int
-pc98_write(int fd, lba_t imgsz __unused, void *bootcode)
+pc98_write(lba_t imgsz __unused, void *bootcode)
{
struct part *part;
struct pc98_partition *dpbase, *dp;
@@ -106,7 +107,7 @@ pc98_write(int fd, lba_t imgsz __unused, void *bootcode)
if (part->label != NULL)
memcpy(dp->dp_name, part->label, strlen(part->label));
}
- error = mkimg_write(fd, 0, buf, PC98_BOOTCODESZ / secsz);
+ error = image_write(0, buf, PC98_BOOTCODESZ / secsz);
free(buf);
return (error);
}
diff --git a/usr.bin/mkimg/raw.c b/usr.bin/mkimg/raw.c
new file mode 100644
index 0000000..759debf
--- /dev/null
+++ b/usr.bin/mkimg/raw.c
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+
+static int
+raw_resize(lba_t imgsz __unused)
+{
+
+ return (0);
+}
+
+static int
+raw_write(int fd)
+{
+
+ return (image_copyout(fd));
+}
+
+static struct mkimg_format raw_format = {
+ .name = "raw",
+ .description = "Raw Disk",
+ .resize = raw_resize,
+ .write = raw_write,
+};
+
+FORMAT_DEFINE(raw_format);
diff --git a/usr.bin/mkimg/scheme.c b/usr.bin/mkimg/scheme.c
index f2a332e..7546ae2 100644
--- a/usr.bin/mkimg/scheme.c
+++ b/usr.bin/mkimg/scheme.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -102,16 +103,12 @@ int
scheme_bootcode(int fd)
{
struct stat sb;
- int error;
- if (fd == -1)
- return (0);
if (scheme->bootcode == 0)
return (ENXIO);
- error = fstat(fd, &sb);
- if (error)
- return (error);
+ if (fstat(fd, &sb) == -1)
+ return (errno);
if (sb.st_size > scheme->bootcode)
return (EFBIG);
@@ -181,17 +178,11 @@ scheme_metadata(u_int where, lba_t start)
}
int
-scheme_write(int fd, lba_t end)
+scheme_write(lba_t end)
{
- u_int cylsz;
int error;
- cylsz = nsecs * nheads;
- ncyls = (end + cylsz - 1) / cylsz;
-
- if (ftruncate(fd, end * secsz) == -1)
- return (errno);
-
- error = scheme->write(fd, end, bootcode);
+ end = image_get_size();
+ error = scheme->write(end, bootcode);
return (error);
}
diff --git a/usr.bin/mkimg/scheme.h b/usr.bin/mkimg/scheme.h
index 4e002db..8224930 100644
--- a/usr.bin/mkimg/scheme.h
+++ b/usr.bin/mkimg/scheme.h
@@ -67,7 +67,7 @@ struct mkimg_scheme {
#define SCHEME_META_IMG_END 2
#define SCHEME_META_PART_BEFORE 3
#define SCHEME_META_PART_AFTER 4
- int (*write)(int, lba_t, void *);
+ int (*write)(lba_t, void *);
u_int nparts;
u_int labellen;
u_int bootcode;
@@ -85,6 +85,6 @@ int scheme_check_part(struct part *);
u_int scheme_max_parts(void);
u_int scheme_max_secsz(void);
lba_t scheme_metadata(u_int, lba_t);
-int scheme_write(int, lba_t);
+int scheme_write(lba_t);
#endif /* _MKIMG_SCHEME_H_ */
diff --git a/usr.bin/mkimg/vhd.c b/usr.bin/mkimg/vhd.c
new file mode 100644
index 0000000..af3d95e
--- /dev/null
+++ b/usr.bin/mkimg/vhd.c
@@ -0,0 +1,386 @@
+/*-
+ * Copyright (c) 2014 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <uuid.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+
+#ifndef __has_extension
+#define __has_extension(x) 0
+#endif
+
+/*
+ * General notes:
+ * o File is in network byte order.
+ * o The timestamp is seconds since 1/1/2000 12:00:00 AM UTC
+ *
+ * This file is divided in 3 parts:
+ * 1. Common definitions
+ * 2. Dynamic VHD support
+ * 3. Fixed VHD support
+ */
+
+/*
+ * PART 1: Common definitions
+ */
+
+#define VHD_SECTOR_SIZE 512
+#define VHD_BLOCK_SIZE (4096 * VHD_SECTOR_SIZE) /* 2MB blocks */
+
+struct vhd_footer {
+ uint64_t cookie;
+#define VHD_FOOTER_COOKIE 0x636f6e6563746978
+ uint32_t features;
+#define VHD_FEATURES_TEMPORARY 0x01
+#define VHD_FEATURES_RESERVED 0x02
+ uint32_t version;
+#define VHD_VERSION 0x00010000
+ uint64_t data_offset;
+ uint32_t timestamp;
+ uint32_t creator_tool;
+#define VHD_CREATOR_TOOL 0x2a696d67 /* FreeBSD mkimg */
+ uint32_t creator_version;
+#define VHD_CREATOR_VERSION 0x00010000
+ uint32_t creator_os;
+#define VHD_CREATOR_OS 0x46425344
+ uint64_t original_size;
+ uint64_t current_size;
+ uint16_t cylinders;
+ uint8_t heads;
+ uint8_t sectors;
+ uint32_t disk_type;
+#define VHD_DISK_TYPE_FIXED 2
+#define VHD_DISK_TYPE_DYNAMIC 3
+#define VHD_DISK_TYPE_DIFF 4
+ uint32_t checksum;
+ uuid_t id;
+ uint8_t saved_state;
+ uint8_t _reserved[427];
+};
+#if __has_extension(c_static_assert)
+_Static_assert(sizeof(struct vhd_footer) == VHD_SECTOR_SIZE,
+ "Wrong size for footer");
+#endif
+
+static uint32_t
+vhd_checksum(void *buf, size_t sz)
+{
+ uint8_t *p = buf;
+ uint32_t sum;
+ size_t ofs;
+
+ sum = 0;
+ for (ofs = 0; ofs < sz; ofs++)
+ sum += p[ofs];
+ return (~sum);
+}
+
+static void
+vhd_geometry(struct vhd_footer *footer, uint64_t image_size)
+{
+ lba_t imgsz;
+ long cth;
+
+ /* Respect command line options if possible. */
+ if (nheads > 1 && nheads < 256 &&
+ nsecs > 1 && nsecs < 256 &&
+ ncyls < 65536) {
+ be16enc(&footer->cylinders, ncyls);
+ footer->heads = nheads;
+ footer->sectors = nsecs;
+ return;
+ }
+
+ imgsz = image_size / VHD_SECTOR_SIZE;
+ if (imgsz > 65536 * 16 * 255)
+ imgsz = 65536 * 16 * 255;
+ if (imgsz >= 65535 * 16 * 63) {
+ be16enc(&footer->cylinders, imgsz / (16 * 255));
+ footer->heads = 16;
+ footer->sectors = 255;
+ return;
+ }
+ footer->sectors = 17;
+ cth = imgsz / 17;
+ footer->heads = (cth + 1023) / 1024;
+ if (footer->heads < 4)
+ footer->heads = 4;
+ if (cth >= (footer->heads * 1024) || footer->heads > 16) {
+ footer->heads = 16;
+ footer->sectors = 31;
+ cth = imgsz / 31;
+ }
+ if (cth >= (footer->heads * 1024)) {
+ footer->heads = 16;
+ footer->sectors = 63;
+ cth = imgsz / 63;
+ }
+ be16enc(&footer->cylinders, cth / footer->heads);
+}
+
+static uint32_t
+vhd_timestamp(void)
+{
+ time_t t;
+
+ if (!unit_testing) {
+ t = time(NULL);
+ return (t - 0x386d4380);
+ }
+
+ return (0x01234567);
+}
+
+static void
+vhd_uuid_enc(void *buf, const uuid_t *uuid)
+{
+ uint8_t *p = buf;
+ int i;
+
+ be32enc(p, uuid->time_low);
+ be16enc(p + 4, uuid->time_mid);
+ be16enc(p + 6, uuid->time_hi_and_version);
+ p[8] = uuid->clock_seq_hi_and_reserved;
+ p[9] = uuid->clock_seq_low;
+ for (i = 0; i < _UUID_NODE_LEN; i++)
+ p[10 + i] = uuid->node[i];
+}
+
+static void
+vhd_make_footer(struct vhd_footer *footer, uint64_t image_size,
+ uint32_t disk_type, uint64_t data_offset)
+{
+ uuid_t id;
+
+ memset(footer, 0, sizeof(*footer));
+ be64enc(&footer->cookie, VHD_FOOTER_COOKIE);
+ be32enc(&footer->features, VHD_FEATURES_RESERVED);
+ be32enc(&footer->version, VHD_VERSION);
+ be64enc(&footer->data_offset, data_offset);
+ be32enc(&footer->timestamp, vhd_timestamp());
+ be32enc(&footer->creator_tool, VHD_CREATOR_TOOL);
+ be32enc(&footer->creator_version, VHD_CREATOR_VERSION);
+ be32enc(&footer->creator_os, VHD_CREATOR_OS);
+ be64enc(&footer->original_size, image_size);
+ be64enc(&footer->current_size, image_size);
+ vhd_geometry(footer, image_size);
+ be32enc(&footer->disk_type, disk_type);
+ mkimg_uuid(&id);
+ vhd_uuid_enc(&footer->id, &id);
+ be32enc(&footer->checksum, vhd_checksum(footer, sizeof(*footer)));
+}
+
+/*
+ * We round the image size to 2MB for both the dynamic and
+ * fixed VHD formats. For dynamic VHD, this is needed to
+ * have the image size be a multiple of the grain size. For
+ * fixed VHD this is not really needed, but makes sure that
+ * it's easy to convert from fixed VHD to dynamic VHD.
+ */
+static int
+vhd_resize(lba_t imgsz)
+{
+ uint64_t imagesz;
+
+ imagesz = imgsz * secsz;
+ imagesz = (imagesz + VHD_BLOCK_SIZE - 1) & ~(VHD_BLOCK_SIZE - 1);
+ return (image_set_size(imagesz / secsz));
+}
+
+/*
+ * PART 2: Dynamic VHD support
+ *
+ * Notes:
+ * o File layout:
+ * copy of disk footer
+ * dynamic disk header
+ * block allocation table (BAT)
+ * data blocks
+ * disk footer
+ */
+
+struct vhd_dyn_header {
+ uint64_t cookie;
+#define VHD_HEADER_COOKIE 0x6378737061727365
+ uint64_t data_offset;
+ uint64_t table_offset;
+ uint32_t version;
+ uint32_t max_entries;
+ uint32_t block_size;
+ uint32_t checksum;
+ uuid_t parent_id;
+ uint32_t parent_timestamp;
+ char _reserved1[4];
+ uint16_t parent_name[256]; /* UTF-16 */
+ struct {
+ uint32_t code;
+ uint32_t data_space;
+ uint32_t data_length;
+ uint32_t _reserved;
+ uint64_t data_offset;
+ } parent_locator[8];
+ char _reserved2[256];
+};
+#if __has_extension(c_static_assert)
+_Static_assert(sizeof(struct vhd_dyn_header) == VHD_SECTOR_SIZE * 2,
+ "Wrong size for header");
+#endif
+
+static int
+vhd_dyn_write(int fd)
+{
+ struct vhd_footer footer;
+ struct vhd_dyn_header header;
+ uint64_t imgsz;
+ lba_t blk, blkcnt, nblks;
+ uint32_t *bat;
+ void *bitmap;
+ size_t batsz;
+ uint32_t sector;
+ int bat_entries, error, entry;
+
+ imgsz = image_get_size() * secsz;
+ bat_entries = imgsz / VHD_BLOCK_SIZE;
+
+ vhd_make_footer(&footer, imgsz, VHD_DISK_TYPE_DYNAMIC, sizeof(footer));
+ if (sparse_write(fd, &footer, sizeof(footer)) < 0)
+ return (errno);
+
+ memset(&header, 0, sizeof(header));
+ be64enc(&header.cookie, VHD_HEADER_COOKIE);
+ be64enc(&header.data_offset, ~0ULL);
+ be64enc(&header.table_offset, sizeof(footer) + sizeof(header));
+ be32enc(&header.version, VHD_VERSION);
+ be32enc(&header.max_entries, bat_entries);
+ be32enc(&header.block_size, VHD_BLOCK_SIZE);
+ be32enc(&header.checksum, vhd_checksum(&header, sizeof(header)));
+ if (sparse_write(fd, &header, sizeof(header)) < 0)
+ return (errno);
+
+ batsz = bat_entries * sizeof(uint32_t);
+ batsz = (batsz + VHD_SECTOR_SIZE - 1) & ~(VHD_SECTOR_SIZE - 1);
+ bat = malloc(batsz);
+ if (bat == NULL)
+ return (errno);
+ memset(bat, 0xff, batsz);
+ blkcnt = VHD_BLOCK_SIZE / secsz;
+ sector = (sizeof(footer) + sizeof(header) + batsz) / VHD_SECTOR_SIZE;
+ for (entry = 0; entry < bat_entries; entry++) {
+ blk = entry * blkcnt;
+ if (image_data(blk, blkcnt)) {
+ be32enc(&bat[entry], sector);
+ sector += (VHD_BLOCK_SIZE / VHD_SECTOR_SIZE) + 1;
+ }
+ }
+ if (sparse_write(fd, bat, batsz) < 0) {
+ free(bat);
+ return (errno);
+ }
+ free(bat);
+
+ bitmap = malloc(VHD_SECTOR_SIZE);
+ if (bitmap == NULL)
+ return (errno);
+ memset(bitmap, 0xff, VHD_SECTOR_SIZE);
+
+ blk = 0;
+ blkcnt = VHD_BLOCK_SIZE / secsz;
+ error = 0;
+ nblks = image_get_size();
+ while (blk < nblks) {
+ if (!image_data(blk, blkcnt)) {
+ blk += blkcnt;
+ continue;
+ }
+ if (sparse_write(fd, bitmap, VHD_SECTOR_SIZE) < 0) {
+ error = errno;
+ break;
+ }
+ error = image_copyout_region(fd, blk, blkcnt);
+ if (error)
+ break;
+ blk += blkcnt;
+ }
+ free(bitmap);
+ if (blk != nblks)
+ return (error);
+
+ if (sparse_write(fd, &footer, sizeof(footer)) < 0)
+ return (errno);
+
+ return (0);
+}
+
+static struct mkimg_format vhd_dyn_format = {
+ .name = "vhd",
+ .description = "Virtual Hard Disk",
+ .resize = vhd_resize,
+ .write = vhd_dyn_write,
+};
+
+FORMAT_DEFINE(vhd_dyn_format);
+
+/*
+ * PART 2: Fixed VHD
+ */
+
+static int
+vhd_fix_write(int fd)
+{
+ struct vhd_footer footer;
+ uint64_t imgsz;
+ int error;
+
+ error = image_copyout(fd);
+ if (!error) {
+ imgsz = image_get_size() * secsz;
+ vhd_make_footer(&footer, imgsz, VHD_DISK_TYPE_FIXED, ~0ULL);
+ if (sparse_write(fd, &footer, sizeof(footer)) < 0)
+ error = errno;
+ }
+ return (error);
+}
+
+static struct mkimg_format vhd_fix_format = {
+ .name = "vhdf",
+ .description = "Fixed Virtual Hard Disk",
+ .resize = vhd_resize,
+ .write = vhd_fix_write,
+};
+
+FORMAT_DEFINE(vhd_fix_format);
diff --git a/usr.bin/mkimg/vmdk.c b/usr.bin/mkimg/vmdk.c
new file mode 100644
index 0000000..176b97b
--- /dev/null
+++ b/usr.bin/mkimg/vmdk.c
@@ -0,0 +1,243 @@
+/*-
+ * Copyright (c) 2014 Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "image.h"
+#include "format.h"
+#include "mkimg.h"
+
+#define VMDK_IMAGE_ROUND 1048576
+#define VMDK_MIN_GRAIN_SIZE 8192
+#define VMDK_SECTOR_SIZE 512
+
+struct vmdk_header {
+ uint32_t magic;
+#define VMDK_MAGIC 0x564d444b
+ uint32_t version;
+#define VMDK_VERSION 1
+ uint32_t flags;
+#define VMDK_FLAGS_NL_TEST (1 << 0)
+#define VMDK_FLAGS_RGT_USED (1 << 1)
+#define VMDK_FLAGS_COMPRESSED (1 << 16)
+#define VMDK_FLAGS_MARKERS (1 << 17)
+ uint64_t capacity;
+ uint64_t grain_size;
+ uint64_t desc_offset;
+ uint64_t desc_size;
+ uint32_t ngtes;
+#define VMDK_NGTES 512
+ uint64_t rgd_offset;
+ uint64_t gd_offset;
+ uint64_t overhead;
+ uint8_t unclean;
+ uint32_t nl_test;
+#define VMDK_NL_TEST 0x0a200d0a
+ uint16_t compress;
+#define VMDK_COMPRESS_NONE 0
+#define VMDK_COMPRESS_DEFLATE 1
+ char padding[433];
+} __attribute__((__packed__));
+
+static const char desc_fmt[] =
+ "# Disk DescriptorFile\n"
+ "version=%d\n"
+ "CID=%08x\n"
+ "parentCID=ffffffff\n"
+ "createType=\"monolithicSparse\"\n"
+ "# Extent description\n"
+ "RW %ju SPARSE \"%s\"\n"
+ "# The Disk Data Base\n"
+ "#DDB\n"
+ "ddb.adapterType = \"ide\"\n"
+ "ddb.geometry.cylinders = \"%u\"\n"
+ "ddb.geometry.heads = \"%u\"\n"
+ "ddb.geometry.sectors = \"%u\"\n";
+
+static uint64_t grainsz;
+
+static int
+vmdk_resize(lba_t imgsz)
+{
+ uint64_t imagesz;
+
+ imagesz = imgsz * secsz;
+ imagesz = (imagesz + VMDK_IMAGE_ROUND - 1) & ~(VMDK_IMAGE_ROUND - 1);
+ grainsz = (blksz < VMDK_MIN_GRAIN_SIZE) ? VMDK_MIN_GRAIN_SIZE : blksz;
+
+ if (verbose)
+ fprintf(stderr, "VMDK: image size = %ju, grain size = %ju\n",
+ (uintmax_t)imagesz, (uintmax_t)grainsz);
+
+ grainsz /= VMDK_SECTOR_SIZE;
+ return (image_set_size(imagesz / secsz));
+}
+
+static int
+vmdk_write(int fd)
+{
+ struct vmdk_header hdr;
+ uint32_t *gt, *gd;
+ char *buf, *desc;
+ off_t cur, lim;
+ uint64_t imagesz;
+ lba_t blkofs, blkcnt;
+ size_t gdsz, gtsz;
+ uint32_t sec, cursec;
+ int error, desc_len, n, ngrains, ngts;
+
+ imagesz = (image_get_size() * secsz) / VMDK_SECTOR_SIZE;
+
+ memset(&hdr, 0, sizeof(hdr));
+ le32enc(&hdr.magic, VMDK_MAGIC);
+ le32enc(&hdr.version, VMDK_VERSION);
+ le32enc(&hdr.flags, VMDK_FLAGS_NL_TEST | VMDK_FLAGS_RGT_USED);
+ le64enc(&hdr.capacity, imagesz);
+ le64enc(&hdr.grain_size, grainsz);
+
+ n = asprintf(&desc, desc_fmt, 1 /*version*/, 0 /*CID*/,
+ (uintmax_t)imagesz /*size*/, "" /*name*/,
+ ncyls /*cylinders*/, nheads /*heads*/, nsecs /*sectors*/);
+ if (n == -1)
+ return (ENOMEM);
+
+ desc_len = (n + VMDK_SECTOR_SIZE - 1) & ~(VMDK_SECTOR_SIZE - 1);
+ desc = realloc(desc, desc_len);
+ memset(desc + n, 0, desc_len - n);
+
+ le64enc(&hdr.desc_offset, 1);
+ le64enc(&hdr.desc_size, desc_len / VMDK_SECTOR_SIZE);
+ le32enc(&hdr.ngtes, VMDK_NGTES);
+
+ sec = desc_len / VMDK_SECTOR_SIZE + 1;
+ le64enc(&hdr.rgd_offset, sec);
+ le64enc(&hdr.gd_offset, sec);
+
+ ngrains = imagesz / grainsz;
+ ngts = (ngrains + VMDK_NGTES - 1) / VMDK_NGTES;
+ gdsz = (ngts * sizeof(uint32_t) + VMDK_SECTOR_SIZE - 1) &
+ ~(VMDK_SECTOR_SIZE - 1);
+ gd = calloc(gdsz, 1);
+ if (gd == NULL) {
+ free(desc);
+ return (ENOMEM);
+ }
+
+ sec += gdsz / VMDK_SECTOR_SIZE;
+ for (n = 0; n < ngts; n++) {
+ le32enc(gd + n, sec);
+ sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE;
+ }
+
+ sec = (sec + grainsz - 1) & ~(grainsz - 1);
+
+ if (verbose)
+ fprintf(stderr, "VMDK: overhead = %ju\n",
+ (uintmax_t)(sec * VMDK_SECTOR_SIZE));
+
+ le64enc(&hdr.overhead, sec);
+ be32enc(&hdr.nl_test, VMDK_NL_TEST);
+
+ gtsz = ngts * VMDK_NGTES * sizeof(uint32_t);
+ gt = calloc(gtsz, 1);
+ if (gt == NULL) {
+ free(gd);
+ free(desc);
+ return (ENOMEM);
+ }
+
+ cursec = sec;
+ blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz;
+ for (n = 0; n < ngrains; n++) {
+ blkofs = n * blkcnt;
+ if (image_data(blkofs, blkcnt)) {
+ le32enc(gt + n, cursec);
+ cursec += grainsz;
+ }
+ }
+
+ error = 0;
+ if (!error && sparse_write(fd, &hdr, VMDK_SECTOR_SIZE) < 0)
+ error = errno;
+ if (!error && sparse_write(fd, desc, desc_len) < 0)
+ error = errno;
+ if (!error && sparse_write(fd, gd, gdsz) < 0)
+ error = errno;
+ if (!error && sparse_write(fd, gt, gtsz) < 0)
+ error = errno;
+ free(gt);
+ free(gd);
+ free(desc);
+ if (error)
+ return (error);
+
+ cur = VMDK_SECTOR_SIZE + desc_len + gdsz + gtsz;
+ lim = sec * VMDK_SECTOR_SIZE;
+ if (cur < lim) {
+ buf = calloc(VMDK_SECTOR_SIZE, 1);
+ if (buf == NULL)
+ error = ENOMEM;
+ while (!error && cur < lim) {
+ if (sparse_write(fd, buf, VMDK_SECTOR_SIZE) < 0)
+ error = errno;
+ cur += VMDK_SECTOR_SIZE;
+ }
+ if (buf != NULL)
+ free(buf);
+ }
+ if (error)
+ return (error);
+
+ blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz;
+ for (n = 0; n < ngrains; n++) {
+ blkofs = n * blkcnt;
+ if (image_data(blkofs, blkcnt)) {
+ error = image_copyout_region(fd, blkofs, blkcnt);
+ if (error)
+ return (error);
+ }
+ }
+ return (image_copyout_done(fd));
+}
+
+static struct mkimg_format vmdk_format = {
+ .name = "vmdk",
+ .description = "Virtual Machine Disk",
+ .resize = vmdk_resize,
+ .write = vmdk_write,
+};
+
+FORMAT_DEFINE(vmdk_format);
diff --git a/usr.bin/mkimg/vtoc8.c b/usr.bin/mkimg/vtoc8.c
index 231f0a2..8eb7d24 100644
--- a/usr.bin/mkimg/vtoc8.c
+++ b/usr.bin/mkimg/vtoc8.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include "image.h"
#include "mkimg.h"
#include "scheme.h"
@@ -62,7 +63,7 @@ vtoc8_metadata(u_int where)
}
static int
-vtoc8_write(int fd, lba_t imgsz, void *bootcode __unused)
+vtoc8_write(lba_t imgsz, void *bootcode __unused)
{
struct vtoc8 vtoc8;
struct part *part;
@@ -70,7 +71,7 @@ vtoc8_write(int fd, lba_t imgsz, void *bootcode __unused)
int error, n;
uint16_t ofs, sum;
- imgsz = ncyls * nheads * nsecs;
+ imgsz = (lba_t)ncyls * nheads * nsecs;
memset(&vtoc8, 0, sizeof(vtoc8));
sprintf(vtoc8.ascii, "FreeBSD%lldM",
@@ -86,7 +87,9 @@ vtoc8_write(int fd, lba_t imgsz, void *bootcode __unused)
be16enc(&vtoc8.nsecs, nsecs);
be16enc(&vtoc8.magic, VTOC_MAGIC);
- ftruncate(fd, imgsz * secsz);
+ error = image_set_size(imgsz);
+ if (error)
+ return (error);
be32enc(&vtoc8.map[VTOC_RAW_PART].nblks, imgsz);
STAILQ_FOREACH(part, &partlist, link) {
@@ -103,7 +106,7 @@ vtoc8_write(int fd, lba_t imgsz, void *bootcode __unused)
sum ^= be16dec(p + ofs);
be16enc(&vtoc8.cksum, sum);
- error = mkimg_write(fd, 0, &vtoc8, 1);
+ error = image_write(0, &vtoc8, 1);
return (error);
}
diff --git a/usr.bin/mkulzma/mkulzma.8 b/usr.bin/mkulzma/mkulzma.8
index d615198..b4ac33f 100644
--- a/usr.bin/mkulzma/mkulzma.8
+++ b/usr.bin/mkulzma/mkulzma.8
@@ -103,5 +103,5 @@ on the mount point provided as the first argument to the script.
.Xr mdconfig 8 ,
.Xr mount_cd9660 8
.Sh AUTHORS
-.An Maxim Sobolev Aq sobomax@FreeBSD.org
-.An Aleksandr Rybalko Aq ray@ddteam.net
+.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
+.An Aleksandr Rybalko Aq Mt ray@ddteam.net
diff --git a/usr.bin/mkuzip/mkuzip.8 b/usr.bin/mkuzip/mkuzip.8
index e6aeb4b..c0b8315 100644
--- a/usr.bin/mkuzip/mkuzip.8
+++ b/usr.bin/mkuzip/mkuzip.8
@@ -103,4 +103,4 @@ on the mount point provided as the first argument to the script.
.Xr mdconfig 8 ,
.Xr mount_cd9660 8
.Sh AUTHORS
-.An Maxim Sobolev Aq sobomax@FreeBSD.org
+.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
diff --git a/usr.bin/msgs/Makefile b/usr.bin/msgs/Makefile
index 21cb151..6c5a8d9 100644
--- a/usr.bin/msgs/Makefile
+++ b/usr.bin/msgs/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PROG= msgs
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.bin/msgs/Makefile.depend b/usr.bin/msgs/Makefile.depend
index 4f4df65..a25f5f6 100644
--- a/usr.bin/msgs/Makefile.depend
+++ b/usr.bin/msgs/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/ncal/Makefile b/usr.bin/ncal/Makefile
index b26605f..1422ce1 100644
--- a/usr.bin/ncal/Makefile
+++ b/usr.bin/ncal/Makefile
@@ -4,8 +4,8 @@
PROG= ncal
-DPADD= ${LIBCALENDAR} ${LIBTERMCAP}
-LDADD= -lcalendar -ltermcap
+DPADD= ${LIBCALENDAR} ${LIBTERMCAPW}
+LDADD= -lcalendar -ltermcapw
LINKS= ${BINDIR}/ncal ${BINDIR}/cal
MLINKS= ncal.1 cal.1
diff --git a/usr.bin/ncal/Makefile.depend b/usr.bin/ncal/Makefile.depend
index 48604c6..5653d06 100644
--- a/usr.bin/ncal/Makefile.depend
+++ b/usr.bin/ncal/Makefile.depend
@@ -11,7 +11,6 @@ DIRDEPS = \
lib/libc \
lib/libcalendar \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/ncal/ncal.1 b/usr.bin/ncal/ncal.1
index 3d71ec3..329db6d 100644
--- a/usr.bin/ncal/ncal.1
+++ b/usr.bin/ncal/ncal.1
@@ -189,7 +189,7 @@ command appeared in
The
.Nm ncal
command and manual were written by
-.An Wolfgang Helbig Aq helbig@FreeBSD.org .
+.An Wolfgang Helbig Aq Mt helbig@FreeBSD.org .
.Sh BUGS
The assignment of Julian\(enGregorian switching dates to country
codes is historically naive for many countries.
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 9f8f1d2..10d0698 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -429,7 +429,7 @@ protopr(u_long off, const char *name, int af1, int proto)
"%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
"Proto", "Recv-Q", "Send-Q",
"Local Address", "Foreign Address");
- if (!xflag)
+ if (!xflag && !Rflag)
printf(" (state)");
}
if (xflag) {
@@ -441,6 +441,9 @@ protopr(u_long off, const char *name, int af1, int proto)
printf(" %7.7s %7.7s %7.7s %7.7s %7.7s %7.7s",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime");
+ } else if (Rflag) {
+ printf (" %8.8s %5.5s",
+ "flowid", "ftype");
}
putchar('\n');
first = 0;
@@ -549,7 +552,7 @@ protopr(u_long off, const char *name, int af1, int proto)
timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
- if (istcp && !Lflag && !xflag && !Tflag) {
+ if (istcp && !Lflag && !xflag && !Tflag && !Rflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
printf("%d", tp->t_state);
else {
@@ -560,7 +563,12 @@ protopr(u_long off, const char *name, int af1, int proto)
putchar('*');
#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
}
- }
+ }
+ if (Rflag) {
+ printf(" %08x %5d",
+ inp->inp_flowid,
+ inp->inp_flowtype);
+ }
putchar('\n');
}
if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 5fe4917..8fc2b4e 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -295,6 +295,7 @@ int numeric_port; /* show ports numerically */
static int pflag; /* show given protocol */
int Qflag; /* show netisr information */
int rflag; /* show routing tables (or routing stats) */
+int Rflag; /* show flow / RSS statistics */
int sflag; /* show protocol statistics */
int Wflag; /* wide display */
int Tflag; /* TCP Information */
@@ -319,7 +320,7 @@ main(int argc, char *argv[])
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
+ while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:RrSTsuWw:xz"))
!= -1)
switch(ch) {
case '4':
@@ -433,6 +434,9 @@ main(int argc, char *argv[])
case 'r':
rflag = 1;
break;
+ case 'R':
+ Rflag = 1;
+ break;
case 's':
++sflag;
break;
@@ -820,18 +824,20 @@ static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
-"usage: netstat [-46AaLnSTWx] [-f protocol_family | -p protocol]\n"
+"usage: netstat [-46AaLnRSTWx] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
" netstat -i | -I interface [-46abdhnW] [-f address_family]\n"
" [-M core] [-N system]",
-" netstat -w wait [-I interface] [-46d] [-M core] [-N system] [-q howmany]",
-" netstat -s [-s] [-46z] [-f protocol_family | -p protocol]\n"
-" [-M core] [-N system]",
-" netstat -i | -I interface [-46s] [-f protocol_family | -p protocol]\n"
+" netstat -w wait [-I interface] [-46d] [-M core] [-N system]\n"
+" [-q howmany]",
+" netstat -s [-46sz] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
+" netstat -i | -I interface -s [-46s]\n"
+" [-f protocol_family | -p protocol] [-M core] [-N system]",
" netstat -m [-M core] [-N system]",
-" netstat -B [-I interface]",
-" netstat -r [-46AanW] [-f address_family] [-M core] [-N system]",
+" netstat -B [-z] [-I interface]",
+" netstat -r [-46AnW] [-F fibnum] [-f address_family]\n"
+" [-M core] [-N system]",
" netstat -rs [-s] [-M core] [-N system]",
" netstat -g [-46W] [-f address_family] [-M core] [-N system]",
" netstat -gs [-46s] [-f address_family] [-M core] [-N system]",
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index 67095d6..1f2bb01 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -28,12 +28,70 @@
.\" @(#)netstat.1 8.8 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd January 11, 2014
+.Dd June 4, 2014
.Dt NETSTAT 1
.Os
.Sh NAME
.Nm netstat
-.Nd show network status
+.Nd show network status and statistics
+.Sh SYNOPSIS
+.Bk -words
+.Bl -tag -width "netstat"
+.It Nm
+.Op Fl 46AaLnRSTWx
+.Op Fl f Ar protocol_family | Fl p Ar protocol
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl i | I Ar interface
+.Op Fl 46abdhnW
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl w Ar wait
+.Op Fl I Ar interface
+.Op Fl 46d
+.Op Fl M Ar core
+.Op Fl N Ar system
+.Op Fl q Ar howmany
+.It Nm Fl s
+.Op Fl 46sz
+.Op Fl f Ar protocol_family | Fl p Ar protocol
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl i | I Ar interface Fl s
+.Op Fl 46s
+.Op Fl f Ar protocol_family | Fl p Ar protocol
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl m
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl B
+.Op Fl z
+.Op Fl I Ar interface
+.It Nm Fl r
+.Op Fl 46AnW
+.Op Fl F Ar fibnum
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl rs
+.Op Fl s
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl g
+.Op Fl 46W
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl gs
+.Op Fl 46s
+.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
+.It Nm Fl Q
+.El
+.Ek
.Sh DESCRIPTION
The
.Nm
@@ -45,7 +103,7 @@ depending on the options for the information presented.
.It Xo
.Bk -words
.Nm
-.Op Fl 46AaLnSTWx
+.Op Fl 46AaLnRSTWx
.Op Fl f Ar protocol_family | Fl p Ar protocol
.Op Fl M Ar core
.Op Fl N Ar system
@@ -53,47 +111,132 @@ depending on the options for the information presented.
.Xc
Display a list of active sockets
(protocol control blocks)
-for each network protocol,
-for a particular
-.Ar protocol_family ,
-or for a single
-.Ar protocol .
-If
-.Fl A
-is also present,
-show the address of a protocol control block (PCB)
+for each network protocol.
+.Pp
+The default display for active sockets shows the local
+and remote addresses, send and receive queue sizes (in bytes), protocol,
+and the internal state of the protocol.
+Address formats are of the form
+.Dq host.port
+or
+.Dq network.port
+if a socket's address specifies a network but no specific host address.
+When known, the host and network addresses are displayed symbolically
+according to the databases
+.Xr hosts 5
+and
+.Xr networks 5 ,
+respectively.
+If a symbolic name for an address is unknown, or if
+the
+.Fl n
+option is specified, the address is printed numerically, according
+to the address family.
+For more information regarding
+the Internet IPv4
+.Dq dot format ,
+refer to
+.Xr inet 3 .
+Unspecified,
+or
+.Dq wildcard ,
+addresses and ports appear as
+.Dq Li * .
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl A
+Show the address of a protocol control block (PCB)
associated with a socket; used for debugging.
-If
-.Fl a
-is also present,
-show the state of all sockets;
+.It Fl a
+Show the state of all sockets;
normally sockets used by server processes are not shown.
-If
-.Fl L
-is also present,
-show the size of the various listen queues.
+.It Fl L
+Show the size of the various listen queues.
The first count shows the number of unaccepted connections,
the second count shows the amount of unaccepted incomplete connections,
and the third count is the maximum number of queued connections.
-If
-.Fl S
-is also present,
-show network addresses as numbers (as with
+.It Fl n
+Do not resolve numeric addresses and port numbers to names.
+See
+.Sx GENERAL OPTIONS .
+.It Fl R
+Display the flowid and flowtype for each socket.
+flowid is a 32 bit hardware specific identifier for each flow.
+flowtype defines which protocol fields are hashed to produce the id.
+A complete listing is available in
+.Pa sys/mbuf.h
+under
+.Dv M_HASHTYPE_* .
+.It Fl S
+Show network addresses as numbers (as with
.Fl n )
but show ports symbolically.
-If
+.It Fl T
+Display diagnostic information from the TCP control block.
+Fields include the number of packets requiring retransmission,
+received out-of-order, and those advertising a zero-sized window.
+.It Fl W
+Avoid truncating addresses even if this causes some fields to overflow.
+.It Fl x
+Display socket buffer and TCP timer statistics for each
+internet socket.
+.Pp
+The
.Fl x
-is present, display socket buffer and tcp timer statistics for each internet socket.
-When
-.Fl T
-is present, display information from the TCP control block, including
-retransmits, out-of-order packets received, and zero-sized windows advertised.
+flag causes
+.Nm
+to output all the information recorded about data
+stored in the socket buffers.
+The fields are:
+.Bl -column ".Li R-MBUF"
+.It Li R-MBUF Ta Number of mbufs in the receive queue.
+.It Li S-MBUF Ta Number of mbufs in the send queue.
+.It Li R-CLUS Ta Number of clusters, of any type, in the receive
+queue.
+.It Li S-CLUS Ta Number of clusters, of any type, in the send queue.
+.It Li R-HIWA Ta Receive buffer high water mark, in bytes.
+.It Li S-HIWA Ta Send buffer high water mark, in bytes.
+.It Li R-LOWA Ta Receive buffer low water mark, in bytes.
+.It Li S-LOWA Ta Send buffer low water mark, in bytes.
+.It Li R-BCNT Ta Receive buffer byte count.
+.It Li S-BCNT Ta Send buffer byte count.
+.It Li R-BMAX Ta Maximum bytes that can be used in the receive buffer.
+.It Li S-BMAX Ta Maximum bytes that can be used in the send buffer.
+.El
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.It Fl p Ar protocol
+Filter by
+.Ar protocol .
+See
+.Sx GENERAL OPTIONS .
+.It Fl M
+Use an alternative core.
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image.
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
.Fl i | I Ar interface
.Op Fl 46abdhnW
.Op Fl f Ar address_family
+.Op Fl M Ar core
+.Op Fl N Ar system
.Ek
.Xc
Show the state of all network interfaces or a single
@@ -105,30 +248,59 @@ An asterisk
.Pq Dq Li *
after an interface name indicates that the interface is
.Dq down .
-If
-.Fl a
-is also present, multicast addresses currently in use are shown
+.Pp
+When
+.Nm
+is invoked with
+.Fl i
+.Pq all interfaces
+or
+.Fl I Ar interface ,
+it provides a table of cumulative
+statistics regarding packets transferred, errors, and collisions.
+The network addresses of the interface
+and the maximum transmission unit
+.Pq Dq mtu
+are also displayed.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl a
+Multicast addresses currently in use are shown
for each Ethernet interface and for each IP interface address.
Multicast addresses are shown on separate lines following the interface
address with which they are associated.
-If
-.Fl b
-is also present, show the number of bytes in and out.
-If
-.Fl d
-is also present, show the number of dropped packets.
-If
-.Fl h
-is also present, print all counters in human readable form.
-If
-.Fl W
-is also present, print interface names using a wider field size.
+.It Fl b
+Show the number of bytes in and out.
+.It Fl d
+Show the number of dropped packets.
+.It Fl h
+Print all counters in human readable form.
+.It Fl n
+Do not resolve numeric addresses and port numbers to names.
+See
+.Sx GENERAL OPTIONS .
+.It Fl W
+Avoid truncating interface names even if this causes some fields to overflow.
+.Sx GENERAL OPTIONS .
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
.Fl w Ar wait
.Op Fl I Ar interface
-.Op Fl d
+.Op Fl 46d
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl q Ar howmany
@@ -136,55 +308,139 @@ is also present, print interface names using a wider field size.
.Xc
At intervals of
.Ar wait
-seconds,
-display the information regarding packet
-traffic on all configured network interfaces
-or a single
+seconds, display the information regarding packet traffic on all
+configured network interfaces or a single
.Ar interface .
-If
-.Fl q
-is also present, exit after
+.Pp
+When
+.Nm
+is invoked with the
+.Fl w
+option and a
+.Ar wait
+interval argument, it displays a running count of statistics related to
+network interfaces.
+An obsolescent version of this option used a numeric parameter
+with no option, and is currently supported for backward compatibility.
+By default, this display summarizes information for all interfaces.
+Information for a specific interface may be displayed with the
+.Fl I Ar interface
+option.
+.Bl -tag -width indent
+.It Fl I Ar interface
+Only show information regarding
+.Ar interface
+.It Fl 4
+Show IPv4 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl d
+Show the number of dropped packets.
+.It Fl M
+Use an alternative core.
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image.
+See
+.Sx GENERAL OPTIONS .
+.It Fl q
+Exit after
.Ar howmany
outputs.
-If
-.Fl d
-is also present, show the number of dropped packets.
+.El
.It Xo
.Bk -words
.Nm
-.Fl s Op Fl s
-.Op Fl 46z
+.Fl s
+.Op Fl 46sz
.Op Fl f Ar protocol_family | Fl p Ar protocol
.Op Fl M Ar core
.Op Fl N Ar system
.Ek
.Xc
-Display system-wide statistics for each network protocol,
-for a particular
-.Ar protocol_family ,
-or for a single
-.Ar protocol .
+Display system-wide statistics for each network protocol.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl s
If
.Fl s
is repeated, counters with a value of zero are suppressed.
-If
-.Fl z
-is also present, reset statistic counters after displaying them.
+.It Fl z
+Reset statistic counters after displaying them.
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.It Fl p Ar protocol
+Filter by
+.Ar protocol .
+See
+.Sx GENERAL OPTIONS .
+.It Fl M
+Use an alternative core.
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
.Fl i | I Ar interface Fl s
-.Op Fl 46
+.Op Fl 46s
.Op Fl f Ar protocol_family | Fl p Ar protocol
.Op Fl M Ar core
.Op Fl N Ar system
.Ek
.Xc
-Display per-interface statistics for each network protocol,
-for a particular
-.Ar protocol_family ,
-or for a single
+Display per-interface statistics for each network protocol.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl s
+If
+.Fl s
+is repeated, counters with a value of zero are suppressed.
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.It Fl p Ar protocol
+Filter by
.Ar protocol .
+See
+.Sx GENERAL OPTIONS .
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -196,6 +452,16 @@ or for a single
Show statistics recorded by the memory management routines
.Pq Xr mbuf 9 .
The network manages a private pool of memory buffers.
+.Bl -tag -width indent
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -211,11 +477,39 @@ This includes information like
how many packets have been matched, dropped and received by the
bpf device, also information about current buffer sizes and device
states.
+.Pp
+The
+.Xr bpf 4
+flags displayed when
+.Nm
+is invoked with the
+.Fl B
+option represent the underlying parameters of the bpf peer.
+Each flag is
+represented as a single lower case letter.
+The mapping between the letters and flags in order of appearance are:
+.Bl -column ".Li i"
+.It Li p Ta Set if listening promiscuously
+.It Li i Ta Dv BIOCIMMEDIATE No has been set on the device
+.It Li f Ta Dv BIOCGHDRCMPLT No status: source link addresses are being
+filled automatically
+.It Li s Ta Dv BIOCGSEESENT No status: see packets originating locally and
+remotely on the interface.
+.It Li a Ta Packet reception generates a signal
+.It Li l Ta Dv BIOCLOCK No status: descriptor has been locked
+.El
+.Pp
+For more information about these flags, please refer to
+.Xr bpf 4 .
+.Bl -tag -width indent
+.It Fl z
+Reset statistic counters after displaying them.
+.El
.It Xo
.Bk -words
.Nm
.Fl r
-.Op Fl 46AanW
+.Op Fl 46AnW
.Op Fl F Ar fibnum
.Op Fl f Ar address_family
.Op Fl M Ar core
@@ -223,35 +517,91 @@ states.
.Ek
.Xc
Display the contents of routing tables.
+.Pp
When
-.Fl f
-is specified, a routing table for a particular
-.Ar address_family
-is displayed.
-When
-.Fl F
-is specified, a routing table with the number
-.Ar fibnum
-is displayed.
+.Nm
+is invoked with the routing table option
+.Fl r ,
+it lists the available routes and their status.
+Each route consists of a destination host or network, and a gateway to use
+in forwarding packets.
+The flags field shows a collection of information about the route stored
+as binary choices.
+The individual flags are discussed in more detail in the
+.Xr route 8
+and
+.Xr route 4
+manual pages.
+The mapping between letters and flags is:
+.Bl -column ".Li W" ".Dv RTF_WASCLONED"
+.It Li 1 Ta Dv RTF_PROTO1 Ta "Protocol specific routing flag #1"
+.It Li 2 Ta Dv RTF_PROTO2 Ta "Protocol specific routing flag #2"
+.It Li 3 Ta Dv RTF_PROTO3 Ta "Protocol specific routing flag #3"
+.It Li B Ta Dv RTF_BLACKHOLE Ta "Just discard pkts (during updates)"
+.It Li b Ta Dv RTF_BROADCAST Ta "The route represents a broadcast address"
+.It Li D Ta Dv RTF_DYNAMIC Ta "Created dynamically (by redirect)"
+.It Li G Ta Dv RTF_GATEWAY Ta "Destination requires forwarding by intermediary"
+.It Li H Ta Dv RTF_HOST Ta "Host entry (net otherwise)"
+.It Li L Ta Dv RTF_LLINFO Ta "Valid protocol to link address translation"
+.It Li M Ta Dv RTF_MODIFIED Ta "Modified dynamically (by redirect)"
+.It Li R Ta Dv RTF_REJECT Ta "Host or net unreachable"
+.It Li S Ta Dv RTF_STATIC Ta "Manually added"
+.It Li U Ta Dv RTF_UP Ta "Route usable"
+.It Li X Ta Dv RTF_XRESOLVE Ta "External daemon translates proto to link address"
+.El
+.Pp
+Direct routes are created for each
+interface attached to the local host;
+the gateway field for such entries shows the address of the outgoing interface.
+The refcnt field gives the
+current number of active uses of the route.
+Connection oriented
+protocols normally hold on to a single route for the duration of
+a connection while connectionless protocols obtain a route while sending
+to the same destination.
+The use field provides a count of the number of packets
+sent using that route.
+The interface entry indicates the network interface utilized for the route.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only.
+See
+.Sx GENERAL OPTIONS .
+.It Fl A
+Show the contents of the internal Patricia tree
+structures; used for debugging.
+.It Fl n
+Do not resolve numeric addresses and port numbers to names.
+See
+.Sx GENERAL OPTIONS .
+.It Fl W
+Show the path MTU for each route, and print interface names with a
+wider field size.
+.It Fl F
+Display the routing table with the number
+.Ar fibnum .
If the specified
.Ar fibnum
is -1 or
.Fl F
is not specified,
the default routing table is displayed.
-If
-.Fl A
-is also present,
-show the contents of the internal Patricia tree
-structures; used for debugging.
-When
-.Fl W
-is also present,
-show the path MTU
-for each route,
-and print interface
-names with a wider
-field size.
+.It Fl f
+Display the routing table for a particular
+.Ar address_family .
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -262,9 +612,20 @@ field size.
.Ek
.Xc
Display routing statistics.
+.Bl -tag -width indent
+.It Fl s
If
.Fl s
is repeated, counters with a value of zero are suppressed.
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -284,6 +645,31 @@ This option is applicable only to the
and
.Cm inet6
address families.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl W
+Avoid truncating addresses even if this causes some fields to overflow.
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -295,9 +681,33 @@ address families.
.Ek
.Xc
Show multicast routing statistics.
+.Bl -tag -width indent
+.It Fl 4
+Show IPv4 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl 6
+Show IPv6 only
+See
+.Sx GENERAL OPTIONS .
+.It Fl s
If
.Fl s
is repeated, counters with a value of zero are suppressed.
+.It Fl f Ar protocol_family
+Filter by
+.Ar protocol_family .
+See
+.Sx GENERAL OPTIONS .
+.It Fl M
+Use an alternative core
+See
+.Sx GENERAL OPTIONS .
+.It Fl N
+Use an alternative kernel image
+See
+.Sx GENERAL OPTIONS .
+.El
.It Xo
.Bk -words
.Nm
@@ -315,16 +725,19 @@ The flags field shows available ISR handlers:
.El
.El
.Pp
+.Ss GENERAL OPTIONS
Some options have the general meaning:
.Bl -tag -width flag
.It Fl 4
Is shorthand for
.Fl f
.Ar inet
+.Pq Show only IPv4
.It Fl 6
Is shorthand for
.Fl f
.Ar inet6
+.Pq Show only IPv6
.It Fl f Ar address_family , Fl p Ar protocol
Limit display to those records
of the specified
@@ -364,149 +777,6 @@ Normally
.Nm
attempts to resolve addresses and ports,
and display them symbolically.
-.It Fl W
-In certain displays, avoid truncating addresses even if this causes
-some fields to overflow.
-.El
-.Pp
-The default display, for active sockets, shows the local
-and remote addresses, send and receive queue sizes (in bytes), protocol,
-and the internal state of the protocol.
-Address formats are of the form
-.Dq host.port
-or
-.Dq network.port
-if a socket's address specifies a network but no specific host address.
-When known, the host and network addresses are displayed symbolically
-according to the databases
-.Xr hosts 5
-and
-.Xr networks 5 ,
-respectively.
-If a symbolic name for an address is unknown, or if
-the
-.Fl n
-option is specified, the address is printed numerically, according
-to the address family.
-For more information regarding
-the Internet IPv4
-.Dq dot format ,
-refer to
-.Xr inet 3 .
-Unspecified,
-or
-.Dq wildcard ,
-addresses and ports appear as
-.Dq Li * .
-.Pp
-The interface display provides a table of cumulative
-statistics regarding packets transferred, errors, and collisions.
-The network addresses of the interface
-and the maximum transmission unit
-.Pq Dq mtu
-are also displayed.
-.Pp
-The routing table display indicates the available routes and their status.
-Each route consists of a destination host or network, and a gateway to use
-in forwarding packets.
-The flags field shows a collection of information about the route stored
-as binary choices.
-The individual flags are discussed in more detail in the
-.Xr route 8
-and
-.Xr route 4
-manual pages.
-The mapping between letters and flags is:
-.Bl -column ".Li W" ".Dv RTF_WASCLONED"
-.It Li 1 Ta Dv RTF_PROTO1 Ta "Protocol specific routing flag #1"
-.It Li 2 Ta Dv RTF_PROTO2 Ta "Protocol specific routing flag #2"
-.It Li 3 Ta Dv RTF_PROTO3 Ta "Protocol specific routing flag #3"
-.It Li B Ta Dv RTF_BLACKHOLE Ta "Just discard pkts (during updates)"
-.It Li b Ta Dv RTF_BROADCAST Ta "The route represents a broadcast address"
-.It Li D Ta Dv RTF_DYNAMIC Ta "Created dynamically (by redirect)"
-.It Li G Ta Dv RTF_GATEWAY Ta "Destination requires forwarding by intermediary"
-.It Li H Ta Dv RTF_HOST Ta "Host entry (net otherwise)"
-.It Li L Ta Dv RTF_LLINFO Ta "Valid protocol to link address translation"
-.It Li M Ta Dv RTF_MODIFIED Ta "Modified dynamically (by redirect)"
-.It Li R Ta Dv RTF_REJECT Ta "Host or net unreachable"
-.It Li S Ta Dv RTF_STATIC Ta "Manually added"
-.It Li U Ta Dv RTF_UP Ta "Route usable"
-.It Li X Ta Dv RTF_XRESOLVE Ta "External daemon translates proto to link address"
-.El
-.Pp
-Direct routes are created for each
-interface attached to the local host;
-the gateway field for such entries shows the address of the outgoing interface.
-The refcnt field gives the
-current number of active uses of the route.
-Connection oriented
-protocols normally hold on to a single route for the duration of
-a connection while connectionless protocols obtain a route while sending
-to the same destination.
-The use field provides a count of the number of packets
-sent using that route.
-The interface entry indicates the network interface utilized for the route.
-.Pp
-When
-.Nm
-is invoked with the
-.Fl w
-option and a
-.Ar wait
-interval argument, it displays a running count of statistics related to
-network interfaces.
-An obsolescent version of this option used a numeric parameter
-with no option, and is currently supported for backward compatibility.
-By default, this display summarizes information for all interfaces.
-Information for a specific interface may be displayed with the
-.Fl I
-option.
-.Pp
-The
-.Xr bpf 4
-flags displayed when
-.Nm
-is invoked with the
-.Fl B
-option represent the underlying parameters of the bpf peer.
-Each flag is
-represented as a single lower case letter.
-The mapping between the letters and flags in order of appearance are:
-.Bl -column ".Li i"
-.It Li p Ta Set if listening promiscuously
-.It Li i Ta Dv BIOCIMMEDIATE No has been set on the device
-.It Li f Ta Dv BIOCGHDRCMPLT No status: source link addresses are being
-filled automatically
-.It Li s Ta Dv BIOCGSEESENT No status: see packets originating locally and
-remotely on the interface.
-.It Li a Ta Packet reception generates a signal
-.It Li l Ta Dv BIOCLOCK No status: descriptor has been locked
-.El
-.Pp
-For more information about these flags, please refer to
-.Xr bpf 4 .
-.Pp
-The
-.Fl x
-flag causes
-.Nm
-to output all the information recorded about data
-stored in the socket buffers.
-The fields are:
-.Bl -column ".Li R-MBUF"
-.It Li R-MBUF Ta Number of mbufs in the receive queue.
-.It Li S-MBUF Ta Number of mbufs in the send queue.
-.It Li R-CLUS Ta Number of clusters, of any type, in the receive
-queue.
-.It Li S-CLUS Ta Number of clusters, of any type, in the send queue.
-.It Li R-HIWA Ta Receive buffer high water mark, in bytes.
-.It Li S-HIWA Ta Send buffer high water mark, in bytes.
-.It Li R-LOWA Ta Receive buffer low water mark, in bytes.
-.It Li S-LOWA Ta Send buffer low water mark, in bytes.
-.It Li R-BCNT Ta Receive buffer byte count.
-.It Li S-BCNT Ta Send buffer byte count.
-.It Li R-BMAX Ta Maximum bytes that can be used in the receive buffer.
-.It Li S-BMAX Ta Maximum bytes that can be used in the send buffer.
.El
.Sh SEE ALSO
.Xr fstat 1 ,
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index ebbdd5d..cb46c0f 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -45,6 +45,7 @@ extern int noutputs; /* how much outputs before we exit */
extern int numeric_addr; /* show addresses numerically */
extern int numeric_port; /* show ports numerically */
extern int rflag; /* show routing tables (or routing stats) */
+extern int Rflag; /* show flowid / RSS information */
extern int sflag; /* show protocol statistics */
extern int Tflag; /* show TCP control block info */
extern int Wflag; /* wide display */
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 3f09459..7555615 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -230,13 +230,13 @@ pr_family(int af1)
#ifndef INET6
#define WID_DST_DEFAULT(af) 18 /* width of destination column */
#define WID_GW_DEFAULT(af) 18 /* width of gateway column */
-#define WID_IF_DEFAULT(af) (Wflag ? 8 : 6) /* width of netif column */
+#define WID_IF_DEFAULT(af) (Wflag ? 10 : 8) /* width of netif column */
#else
#define WID_DST_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18)
#define WID_GW_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18)
-#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 8 : 6))
+#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 10 : 8))
#endif /*INET6*/
static int wid_dst;
@@ -586,19 +586,18 @@ p_rtable_sysctl(int fibnum, int af)
mib[4] = NET_RT_DUMP;
mib[5] = 0;
mib[6] = fibnum;
- if (sysctl(mib, 7, NULL, &needed, NULL, 0) < 0) {
- err(1, "sysctl: net.route.0.%d.dump.%d estimate", af, fibnum);
- }
-
- if ((buf = malloc(needed)) == 0) {
+ if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0)
+ err(EX_OSERR, "sysctl: net.route.0.%d.dump.%d estimate", af,
+ fibnum);
+ if ((buf = malloc(needed)) == NULL)
errx(2, "malloc(%lu)", (unsigned long)needed);
- }
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+ if (sysctl(mib, nitems(mib), buf, &needed, NULL, 0) < 0)
err(1, "sysctl: net.route.0.%d.dump.%d", af, fibnum);
- }
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
+ if (rtm->rtm_version != RTM_VERSION)
+ continue;
/*
* Peek inside header to determine AF
*/
@@ -611,6 +610,7 @@ p_rtable_sysctl(int fibnum, int af)
}
p_rtentry_sysctl(rtm);
}
+ free(buf);
}
static void
@@ -971,9 +971,9 @@ in6_fillscopeid(struct sockaddr_in6 *sa6)
if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr) ||
IN6_IS_ADDR_MC_NODELOCAL(&sa6->sin6_addr) ||
IN6_IS_ADDR_MC_LINKLOCAL(&sa6->sin6_addr)) {
- /* XXX: override is ok? */
- sa6->sin6_scope_id =
- ntohs(*(u_int16_t *)&sa6->sin6_addr.s6_addr[2]);
+ if (sa6->sin6_scope_id == 0)
+ sa6->sin6_scope_id =
+ ntohs(*(u_int16_t *)&sa6->sin6_addr.s6_addr[2]);
sa6->sin6_addr.s6_addr[2] = sa6->sin6_addr.s6_addr[3] = 0;
}
#endif
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1
index 587b166..aac69de 100644
--- a/usr.bin/patch/patch.1
+++ b/usr.bin/patch/patch.1
@@ -19,9 +19,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: patch.1,v 1.26 2010/09/03 11:09:29 jmc Exp $
+.\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $
.\" $FreeBSD$
-.Dd January 29, 2013
+.Dd June 15, 2014
.Dt PATCH 1
.Os
.Sh NAME
@@ -107,7 +107,7 @@ This is equivalent to specifying
This option is currently the default, unless
.Fl -posix
is specified.
-.It Fl C , Fl Fl check
+.It Fl C , Fl Fl check , Fl Fl dry-run
Checks that the patch would apply cleanly, but does not modify anything.
.It Fl c , Fl Fl context
Forces
@@ -639,13 +639,10 @@ The
.Nm
utility is compliant with the
.St -p1003.1-2008
-specification
-(except as detailed above for the
+specification,
+except as detailed above for the
.Fl -posix
-option),
-though the presence of
-.Nm
-itself is optional.
+option.
.Pp
The flags
.Op Fl BCEFfstVvxz
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 1743678..85daf7f 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -469,6 +469,7 @@ get_some_switches(void)
{"context", no_argument, 0, 'c'},
{"debug", required_argument, 0, 'x'},
{"directory", required_argument, 0, 'd'},
+ {"dry-run", no_argument, 0, 'C'},
{"ed", no_argument, 0, 'e'},
{"force", no_argument, 0, 'f'},
{"forward", no_argument, 0, 'N'},
@@ -742,14 +743,18 @@ abort_context_hunk(void)
static void
rej_line(int ch, LINENUM i)
{
- size_t len;
+ unsigned short len;
const char *line = pfetch(i);
- len = strlen(line);
+ len = strnlen(line, USHRT_MAX);
fprintf(rejfp, "%c%s", ch, line);
- if (len == 0 || line[len-1] != '\n')
- fprintf(rejfp, "\n\\ No newline at end of file\n");
+ if (len == 0 || line[len-1] != '\n') {
+ if (len >= USHRT_MAX)
+ fprintf(rejfp, "\n\\ Line too long\n");
+ else
+ fprintf(rejfp, "\n\\ No newline at end of line\n");
+ }
}
static void
@@ -1016,7 +1021,7 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
LINENUM pat_lines = pch_ptrn_lines() - fuzz;
const char *ilineptr;
const char *plineptr;
- short plinelen;
+ unsigned short plinelen;
for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
ilineptr = ifetch(iline, offset >= 0);
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index eca12ad..d9c4b3d 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -56,7 +56,7 @@ static LINENUM p_max; /* max allowed value of p_end */
static LINENUM p_context = 3; /* # of context lines */
static LINENUM p_input_line = 0; /* current line # from patch file */
static char **p_line = NULL;/* the text of the hunk */
-static short *p_len = NULL; /* length of each line */
+static unsigned short *p_len = NULL; /* length of each line */
static char *p_char = NULL; /* +, -, and ! */
static int hunkmax = INITHUNKMAX; /* size of above arrays to begin with */
static int p_indent; /* indent to patch */
@@ -132,11 +132,11 @@ void
set_hunkmax(void)
{
if (p_line == NULL)
- p_line = calloc((size_t) hunkmax, sizeof(char *));
+ p_line = malloc(hunkmax * sizeof(char *));
if (p_len == NULL)
- p_len = calloc((size_t) hunkmax, sizeof(short));
+ p_len = malloc(hunkmax * sizeof(unsigned short));
if (p_char == NULL)
- p_char = calloc((size_t) hunkmax, sizeof(char));
+ p_char = malloc(hunkmax * sizeof(char));
}
/*
@@ -145,31 +145,14 @@ set_hunkmax(void)
static void
grow_hunkmax(void)
{
- int new_hunkmax;
- char **new_p_line;
- short *new_p_len;
- char *new_p_char;
-
- new_hunkmax = hunkmax * 2;
+ int new_hunkmax = hunkmax * 2;
if (p_line == NULL || p_len == NULL || p_char == NULL)
fatal("Internal memory allocation error\n");
- new_p_line = realloc(p_line, new_hunkmax * sizeof(char *));
- if (new_p_line == NULL)
- free(p_line);
-
- new_p_len = realloc(p_len, new_hunkmax * sizeof(short));
- if (new_p_len == NULL)
- free(p_len);
-
- new_p_char = realloc(p_char, new_hunkmax * sizeof(char));
- if (new_p_char == NULL)
- free(p_char);
-
- p_char = new_p_char;
- p_len = new_p_len;
- p_line = new_p_line;
+ p_line = reallocf(p_line, new_hunkmax * sizeof(char *));
+ p_len = reallocf(p_len, new_hunkmax * sizeof(unsigned short));
+ p_char = reallocf(p_char, new_hunkmax * sizeof(char));
if (p_line != NULL && p_len != NULL && p_char != NULL) {
hunkmax = new_hunkmax;
@@ -1218,7 +1201,7 @@ bool
pch_swap(void)
{
char **tp_line; /* the text of the hunk */
- short *tp_len; /* length of each line */
+ unsigned short *tp_len;/* length of each line */
char *tp_char; /* +, -, and ! */
LINENUM i;
LINENUM n;
@@ -1375,7 +1358,7 @@ pch_context(void)
/*
* Return the length of a particular patch line.
*/
-short
+unsigned short
pch_line_len(LINENUM line)
{
return p_len[line];
diff --git a/usr.bin/patch/pch.h b/usr.bin/patch/pch.h
index e60cc86..da7a08d 100644
--- a/usr.bin/patch/pch.h
+++ b/usr.bin/patch/pch.h
@@ -44,7 +44,7 @@ bool there_is_another_patch(void);
bool another_hunk(void);
bool pch_swap(void);
char *pfetch(LINENUM);
-short pch_line_len(LINENUM);
+unsigned short pch_line_len(LINENUM);
LINENUM pch_first(void);
LINENUM pch_ptrn_lines(void);
LINENUM pch_newfirst(void);
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index ac122f7..452711e 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -101,6 +101,8 @@ static void usage(void);
static const char digits[] = "0123456789";
+static char end_fmt[1];
+
static int myargc;
static char **myargv;
static char **gargv;
@@ -171,11 +173,11 @@ main(int argc, char *argv[])
fmt += 2;
} else {
fmt = printf_doformat(fmt, &rval);
- if (fmt == NULL) {
+ if (fmt == NULL || fmt == end_fmt) {
#ifdef SHELL
INTON;
#endif
- return (1);
+ return (fmt == NULL ? 1 : rval);
}
end = 0;
}
@@ -215,13 +217,11 @@ printf_doformat(char *fmt, int *rval)
static const char skip1[] = "#'-+ 0";
int fieldwidth, haveprec, havewidth, mod_ldbl, precision;
char convch, nextch;
- char *start;
+ char start[strlen(fmt) + 1];
char **fargv;
char *dptr;
int l;
- start = alloca(strlen(fmt) + 1);
-
dptr = start;
*dptr++ = '%';
*dptr = 0;
@@ -244,11 +244,11 @@ printf_doformat(char *fmt, int *rval)
/* save format argument */
fargv = gargv;
} else {
- fargv = NULL;
+ fargv = NULL;
}
/* skip to field width */
- while (strchr(skip1, *fmt) != NULL) {
+ while (*fmt && strchr(skip1, *fmt) != NULL) {
*dptr++ = *fmt++;
*dptr = 0;
}
@@ -259,12 +259,19 @@ printf_doformat(char *fmt, int *rval)
l = strspn(fmt, digits);
if ((l > 0) && (fmt[l] == '$')) {
int idx = atoi(fmt);
+ if (fargv == NULL) {
+ warnx("incomplete use of n$");
+ return (NULL);
+ }
if (idx <= myargc) {
gargv = &myargv[idx - 1];
} else {
gargv = &myargv[myargc];
}
fmt += l + 1;
+ } else if (fargv != NULL) {
+ warnx("incomplete use of n$");
+ return (NULL);
}
if (getint(&fieldwidth))
@@ -296,12 +303,19 @@ printf_doformat(char *fmt, int *rval)
l = strspn(fmt, digits);
if ((l > 0) && (fmt[l] == '$')) {
int idx = atoi(fmt);
+ if (fargv == NULL) {
+ warnx("incomplete use of n$");
+ return (NULL);
+ }
if (idx <= myargc) {
gargv = &myargv[idx - 1];
} else {
gargv = &myargv[myargc];
}
fmt += l + 1;
+ } else if (fargv != NULL) {
+ warnx("incomplete use of n$");
+ return (NULL);
}
if (getint(&precision))
@@ -374,7 +388,7 @@ printf_doformat(char *fmt, int *rval)
fputs(p, stdout);
free(p);
if (getout)
- exit(*rval);
+ return (end_fmt);
break;
}
case 'c': {
@@ -442,8 +456,7 @@ mknum(char *str, char ch)
len = strlen(str) + 2;
if (len > copy_size) {
newlen = ((len + 1023) >> 10) << 10;
- if ((newcopy = realloc(copy, newlen)) == NULL)
- {
+ if ((newcopy = realloc(copy, newlen)) == NULL) {
warnx("%s", strerror(ENOMEM));
return (NULL);
}
@@ -575,7 +588,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int signedconv)
int rval;
if (!*gargv) {
- *ip = 0;
+ *ip = *uip = 0;
return (0);
}
if (**gargv == '"' || **gargv == '\'') {
diff --git a/usr.bin/printf/tests/Makefile b/usr.bin/printf/tests/Makefile
index da3f533..5e212ef 100644
--- a/usr.bin/printf/tests/Makefile
+++ b/usr.bin/printf/tests/Makefile
@@ -15,6 +15,7 @@ FILES+= regress.m2.out
FILES+= regress.m3.out
FILES+= regress.m4.out
FILES+= regress.m5.out
+FILES+= regress.missingpos1.out
FILES+= regress.s.out
FILES+= regress.sh
FILES+= regress.zero.out
diff --git a/usr.bin/printf/tests/regress.m2.out b/usr.bin/printf/tests/regress.m2.out
index 8baef1b..cf14915 100644
--- a/usr.bin/printf/tests/regress.m2.out
+++ b/usr.bin/printf/tests/regress.m2.out
@@ -1 +1,2 @@
abc
+cdef \ No newline at end of file
diff --git a/usr.bin/printf/tests/regress.missingpos1.out b/usr.bin/printf/tests/regress.missingpos1.out
new file mode 100644
index 0000000..3b04f03
--- /dev/null
+++ b/usr.bin/printf/tests/regress.missingpos1.out
@@ -0,0 +1 @@
+printf: incomplete use of n$
diff --git a/usr.bin/printf/tests/regress.sh b/usr.bin/printf/tests/regress.sh
index 84e183b..c9668a3 100644
--- a/usr.bin/printf/tests/regress.sh
+++ b/usr.bin/printf/tests/regress.sh
@@ -2,7 +2,7 @@
REGRESSION_START($1)
-echo '1..15'
+echo '1..23'
REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
@@ -19,5 +19,13 @@ REGRESSION_TEST('zero', `printf "%u%u\n" 15')
REGRESSION_TEST('zero', `printf "%d%d\n" 15')
REGRESSION_TEST('zero', `printf "%d%u\n" 15')
REGRESSION_TEST('zero', `printf "%u%d\n" 15')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*s" 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$s" 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*.*1\$s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
REGRESSION_END()
diff --git a/usr.bin/procstat/Makefile b/usr.bin/procstat/Makefile
index 505523e..4def311 100644
--- a/usr.bin/procstat/Makefile
+++ b/usr.bin/procstat/Makefile
@@ -11,6 +11,7 @@ SRCS= procstat.c \
procstat_files.c \
procstat_kstack.c \
procstat_rlimit.c \
+ procstat_rusage.c \
procstat_sigs.c \
procstat_threads.c \
procstat_vm.c
diff --git a/usr.bin/procstat/procstat.1 b/usr.bin/procstat/procstat.1
index f06b2bc..f33c746 100644
--- a/usr.bin/procstat/procstat.1
+++ b/usr.bin/procstat/procstat.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 11, 2014
+.Dd May 16, 2014
.Dt PROCSTAT 1
.Os
.Sh NAME
@@ -33,11 +33,9 @@
.Nd get detailed process information
.Sh SYNOPSIS
.Nm
-.Op Fl h
-.Op Fl n
-.Op Fl C
+.Op Fl CHhn
.Op Fl w Ar interval
-.Op Fl b | c | e | f | i | j | k | l | s | t | v | x
+.Op Fl b | c | e | f | i | j | k | l | r | s | t | v | x
.Op Fl a | Ar pid | Ar core ...
.Sh DESCRIPTION
The
@@ -65,7 +63,7 @@ Display file descriptor information for the process.
.It Fl i
Display signal pending and disposition information for the process.
.It Fl j
-Display signal pending and blocked information for the process threads.
+Display signal pending and blocked information for the process's threads.
.It Fl k
Display the stacks of kernel threads in the process, excluding stacks of
threads currently running on a CPU and threads with stacks swapped to disk.
@@ -73,6 +71,8 @@ If the flag is repeated, function offsets as well as function names are
printed.
.It Fl l
Display resource limits for the process.
+.It Fl r
+Display resource usage information for the process.
.It Fl s
Display security credential information for the process.
.It Fl t
@@ -102,6 +102,13 @@ The
flag requests the printing of additional capability information in the file
descriptor view.
.Pp
+The
+.Fl H
+flag may be used to request per-thread statistics rather than per-process
+statistics for some options.
+For those options, the second field in the table will list the thread ID
+to which the row of information corresponds.
+.Pp
Some information, such as VM and file descriptor information, is available
only to the owner of a process or the superuser.
.Ss Binary Information
@@ -128,6 +135,17 @@ command
.It ARGS
command line arguments (if available)
.El
+.Ss Environment Variables
+Display the process ID, command, and environment variables:
+.Pp
+.Bl -tag -width "ENVIRONMENT" -compact
+.It PID
+process ID
+.It COMM
+command
+.It ENVIRONMENT
+environment variables (if available)
+.El
.Ss File Descriptors
Display detailed information about each file descriptor referenced by a
process, including the process ID, command, file descriptor number, and
@@ -237,7 +255,7 @@ present for each capability descriptor.
.Ss Signal Disposition Information
Display signal pending and disposition for a process:
.Pp
-.Bl -tag -width ident -compact
+.Bl -tag -width indent -compact
.It PID
process ID
.It COMM
@@ -260,15 +278,15 @@ If
.Fl n
switch is given, the signal numbers are shown instead of signal names.
.Ss Thread Signal Information
-Display signal pending and blocked for a process threads:
+Display signal pending and blocked for a process's threads:
.Pp
-.Bl -tag -width ident -compact
+.Bl -tag -width indent -compact
.It PID
process ID
-.It COMM
-command
.It TID
thread ID
+.It COMM
+command
.It SIG
signal name
.It FLAGS
@@ -285,7 +303,7 @@ The
.Fl n
switch has the same effect as for the
.Fl i
-switch, the signals numbers are shown instead of signal names.
+switch: the signal numbers are shown instead of signal names.
.Ss Kernel Thread Stacks
Display kernel thread stacks for a process, allowing further interpretation
of thread wait channels.
@@ -311,6 +329,45 @@ thread name
.It KSTACK
kernel thread call stack
.El
+.Ss Resource Limits
+Display resource limits for a process:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It RLIMIT
+resource limit name
+.It SOFT
+soft limit
+.It HARD
+hard limit
+.El
+.Ss Resource Usage
+Display resource usage for a process.
+If the
+.Fl H
+flag is specified,
+resource usage for individual threads is displayed instead.
+.Pp
+.Bl -tag -width "RESOURCE" -compact
+.It PID
+process ID
+.It TID
+thread ID
+.Po
+if
+.Fl H
+is specified
+.Pc
+.It COMM
+command
+.It RESOURCE
+resource name
+.It VALUE
+current usage
+.El
.Ss Security Credentials
Display process credential information:
.Pp
@@ -388,7 +445,7 @@ private resident pages
reference count
.It SHD
shadow page count
-.It FL
+.It FLAG
mapping flags
.It TP
VM object type
@@ -443,6 +500,19 @@ grows down (top-down stack)
.It U
grows up (bottom-up stack)
.El
+.Ss ELF Auxiliary Vector
+Display ELF auxiliary vector values:
+.Pp
+.Bl -tag -width indent -compact
+.It PID
+process ID
+.It COMM
+command
+.It AUXV
+auxiliary vector name
+.It VALUE
+auxiliary vector value
+.El
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
diff --git a/usr.bin/procstat/procstat.c b/usr.bin/procstat/procstat.c
index 3c1dafa..de0237f 100644
--- a/usr.bin/procstat/procstat.c
+++ b/usr.bin/procstat/procstat.c
@@ -39,18 +39,19 @@
#include "procstat.h"
-static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, lflag, sflag;
-static int tflag, vflag, xflag;
-int hflag, nflag, Cflag;
+static int aflag, bflag, cflag, eflag, fflag, iflag, jflag, kflag, lflag, rflag;
+static int sflag, tflag, vflag, xflag;
+int hflag, nflag, Cflag, Hflag;
static void
usage(void)
{
- fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] "
+ fprintf(stderr, "usage: procstat [-CHhn] [-M core] [-N system] "
"[-w interval] \n");
fprintf(stderr, " [-b | -c | -e | -f | -i | -j | -k | "
- "-l | -s | -t | -v | -x] [-a | pid | core ...]\n");
+ "-l | -r | -s | -t | -v | -x]\n");
+ fprintf(stderr, " [-a | pid | core ...]\n");
exit(EX_USAGE);
}
@@ -74,6 +75,8 @@ procstat(struct procstat *prstat, struct kinfo_proc *kipp)
procstat_kstack(prstat, kipp, kflag);
else if (lflag)
procstat_rlimit(prstat, kipp);
+ else if (rflag)
+ procstat_rusage(prstat, kipp);
else if (sflag)
procstat_cred(prstat, kipp);
else if (tflag)
@@ -125,12 +128,16 @@ main(int argc, char *argv[])
interval = 0;
memf = nlistf = NULL;
- while ((ch = getopt(argc, argv, "CN:M:abcefijklhstvw:x")) != -1) {
+ while ((ch = getopt(argc, argv, "CHN:M:abcefijklhrstvw:x")) != -1) {
switch (ch) {
case 'C':
Cflag++;
break;
+ case 'H':
+ Hflag++;
+ break;
+
case 'M':
memf = optarg;
break;
@@ -181,6 +188,10 @@ main(int argc, char *argv[])
hflag++;
break;
+ case 'r':
+ rflag++;
+ break;
+
case 's':
sflag++;
break;
@@ -217,7 +228,7 @@ main(int argc, char *argv[])
/* We require that either 0 or 1 mode flags be set. */
tmp = bflag + cflag + eflag + fflag + iflag + jflag + (kflag ? 1 : 0) +
- lflag + sflag + tflag + vflag + xflag;
+ lflag + rflag + sflag + tflag + vflag + xflag;
if (!(tmp == 0 || tmp == 1))
usage();
diff --git a/usr.bin/procstat/procstat.h b/usr.bin/procstat/procstat.h
index 57c9cb5..98282b3 100644
--- a/usr.bin/procstat/procstat.h
+++ b/usr.bin/procstat/procstat.h
@@ -29,7 +29,7 @@
#ifndef PROCSTAT_H
#define PROCSTAT_H
-extern int hflag, nflag, Cflag;
+extern int hflag, nflag, Cflag, Hflag;
struct kinfo_proc;
void kinfo_proc_sort(struct kinfo_proc *kipp, int count);
@@ -44,6 +44,7 @@ void procstat_files(struct procstat *prstat, struct kinfo_proc *kipp);
void procstat_kstack(struct procstat *prstat, struct kinfo_proc *kipp,
int kflag);
void procstat_rlimit(struct procstat *prstat, struct kinfo_proc *kipp);
+void procstat_rusage(struct procstat *prstat, struct kinfo_proc *kipp);
void procstat_sigs(struct procstat *prstat, struct kinfo_proc *kipp);
void procstat_threads(struct procstat *prstat, struct kinfo_proc *kipp);
void procstat_threads_sigs(struct procstat *prstat, struct kinfo_proc *kipp);
diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c
index af4f11f..85c51f3 100644
--- a/usr.bin/procstat/procstat_files.c
+++ b/usr.bin/procstat/procstat_files.c
@@ -114,7 +114,7 @@ addr_to_string(struct sockaddr_storage *ss, char *buffer, int buflen)
snprintf(buffer, buflen, "%s.%d", buffer2,
ntohs(sin6->sin6_port));
else
- strlcpy(buffer, "-", sizeof(buffer));
+ strlcpy(buffer, "-", buflen);
break;
default:
@@ -317,12 +317,12 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
if (!hflag) {
if (Cflag)
- printf("%5s %-16s %4s %1s %-9s %-*s "
+ printf("%5s %-16s %5s %1s %-8s %-*s "
"%-3s %-12s\n", "PID", "COMM", "FD", "T",
"FLAGS", capwidth, "CAPABILITIES", "PRO",
"NAME");
else
- printf("%5s %-16s %4s %1s %1s %-9s "
+ printf("%5s %-16s %5s %1s %1s %-8s "
"%3s %7s %-3s %-12s\n", "PID", "COMM", "FD", "T",
"V", "FLAGS", "REF", "OFFSET", "PRO", "NAME");
}
@@ -450,6 +450,7 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp)
printf("%s", fst->fs_fflags & PS_FST_FFLAG_NONBLOCK ? "n" : "-");
printf("%s", fst->fs_fflags & PS_FST_FFLAG_DIRECT ? "d" : "-");
printf("%s", fst->fs_fflags & PS_FST_FFLAG_HASLOCK ? "l" : "-");
+ printf(" ");
if (!Cflag) {
if (fst->fs_ref_count > -1)
printf("%3d ", fst->fs_ref_count);
diff --git a/usr.bin/procstat/procstat_rusage.c b/usr.bin/procstat/procstat_rusage.c
new file mode 100644
index 0000000..b3c9d99
--- /dev/null
+++ b/usr.bin/procstat/procstat_rusage.c
@@ -0,0 +1,161 @@
+/*-
+ * Copyright (c) 2012 Advanced Computing Technologies LLC
+ * Written by: John H. Baldwin <jhb@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+#include <libprocstat.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <libutil.h>
+
+#include "procstat.h"
+
+static struct {
+ const char *ri_name;
+ bool ri_humanize;
+ int ri_scale;
+} rusage_info[] = {
+ { "maximum RSS", true, 1 },
+ { "integral shared memory", true, 1 },
+ { "integral unshared data", true, 1 },
+ { "integral unshared stack", true, 1 },
+ { "page reclaims", false, 0 },
+ { "page faults", false, 0 },
+ { "swaps", false, 0 },
+ { "block reads", false, 0 },
+ { "block writes", false, 0 },
+ { "messages sent", false, 0 },
+ { "messages received", false, 0 },
+ { "signals received", false, 0 },
+ { "voluntary context switches", false, 0 },
+ { "involuntary context switches", false, 0 }
+};
+
+/* xxx days hh:mm:ss.uuuuuu */
+static const char *
+format_time(struct timeval *tv)
+{
+ static char buffer[32];
+ int days, hours, minutes, seconds, used;
+
+ minutes = tv->tv_sec / 60;
+ seconds = tv->tv_sec % 60;
+ hours = minutes / 60;
+ minutes %= 60;
+ days = hours / 24;
+ hours %= 24;
+ used = 0;
+ if (days == 1)
+ used += snprintf(buffer, sizeof(buffer), "1 day ");
+ else if (days > 0)
+ used += snprintf(buffer, sizeof(buffer), "%u days ", days);
+
+ snprintf(buffer + used, sizeof(buffer) - used, "%02u:%02u:%02u.%06u ",
+ hours, minutes, seconds, (unsigned int)tv->tv_usec);
+ return (buffer);
+}
+
+static const char *
+format_value(long value, bool humanize, int scale)
+{
+ static char buffer[14];
+
+ if (scale != 0)
+ value <<= scale * 10;
+ if (humanize)
+ humanize_number(buffer, sizeof(buffer), value, "B",
+ scale, HN_DECIMAL);
+ else
+ snprintf(buffer, sizeof(buffer), "%ld ", value);
+ return (buffer);
+}
+
+static void
+print_prefix(struct kinfo_proc *kipp)
+{
+
+ printf("%5d ", kipp->ki_pid);
+ if (Hflag)
+ printf("%6d ", kipp->ki_tid);
+ printf("%-16s ", kipp->ki_comm);
+}
+
+static void
+print_rusage(struct kinfo_proc *kipp)
+{
+ long *lp;
+ unsigned int i;
+
+ print_prefix(kipp);
+ printf("%-14s %32s\n", "user time",
+ format_time(&kipp->ki_rusage.ru_utime));
+ print_prefix(kipp);
+ printf("%-14s %32s\n", "system time",
+ format_time(&kipp->ki_rusage.ru_stime));
+ lp = &kipp->ki_rusage.ru_maxrss;
+ for (i = 0; i < nitems(rusage_info); i++) {
+ print_prefix(kipp);
+ printf("%-32s %14s\n", rusage_info[i].ri_name,
+ format_value(*lp, rusage_info[i].ri_humanize,
+ rusage_info[i].ri_scale));
+ lp++;
+ }
+}
+
+void
+procstat_rusage(struct procstat *procstat, struct kinfo_proc *kipp)
+{
+ struct kinfo_proc *kip;
+ unsigned int count, i;
+
+ if (!hflag) {
+ printf("%5s ", "PID");
+ if (Hflag)
+ printf("%6s ", "TID");
+ printf("%-16s %-32s %14s\n", "COMM", "RESOURCE",
+ "VALUE ");
+ }
+
+ if (!Hflag) {
+ print_rusage(kipp);
+ return;
+ }
+
+ kip = procstat_getprocs(procstat, KERN_PROC_PID | KERN_PROC_INC_THREAD,
+ kipp->ki_pid, &count);
+ if (kip == NULL)
+ return;
+ kinfo_proc_sort(kip, count);
+ for (i = 0; i < count; i++)
+ print_rusage(&kip[i]);
+ procstat_freeprocs(procstat, kip);
+}
diff --git a/usr.bin/procstat/procstat_vm.c b/usr.bin/procstat/procstat_vm.c
index 80fe6a1..e4de492 100644
--- a/usr.bin/procstat/procstat_vm.c
+++ b/usr.bin/procstat/procstat_vm.c
@@ -50,9 +50,9 @@ procstat_vm(struct procstat *procstat, struct kinfo_proc *kipp)
ptrwidth = 2*sizeof(void *) + 2;
if (!hflag)
- printf("%5s %*s %*s %3s %4s %4s %3s %3s %4s %-2s %-s\n",
+ printf("%5s %*s %*s %3s %4s %4s %3s %3s %-4s %-2s %-s\n",
"PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES",
- "PRES", "REF", "SHD", "FL", "TP", "PATH");
+ "PRES", "REF", "SHD", "FLAG", "TP", "PATH");
freep = procstat_getvmmap(procstat, kipp, &cnt);
if (freep == NULL)
diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8
index 02bdd0c..f7afee9 100644
--- a/usr.bin/rctl/rctl.8
+++ b/usr.bin/rctl/rctl.8
@@ -268,7 +268,7 @@ command appeared in
The
.Nm
was developed by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
under sponsorship from the FreeBSD Foundation.
.Sh BUGS
Limiting
diff --git a/usr.bin/revoke/revoke.1 b/usr.bin/revoke/revoke.1
index 6dd6e2f..2ab52c3 100644
--- a/usr.bin/revoke/revoke.1
+++ b/usr.bin/revoke/revoke.1
@@ -53,4 +53,4 @@ The
program first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index bf53a28..b7b255a 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -878,8 +878,8 @@ $(TARGETS_SVC.c) \n\n");
f_print(fout, "\t$(CC) -o $(CLIENT) $(OBJECTS_CLNT) \
$(LDLIBS) \n\n");
f_print(fout, "$(SERVER) : $(OBJECTS_SVC) \n");
- f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n ");
- f_print(fout, "clean:\n\t $(RM) -f core $(TARGETS) $(OBJECTS_CLNT) \
+ f_print(fout, "\t$(CC) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n");
+ f_print(fout, "clean:\n\t rm -f core $(TARGETS) $(OBJECTS_CLNT) \
$(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
}
diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c
index 3a4e392..6a2bef8 100644
--- a/usr.bin/rpcgen/rpc_sample.c
+++ b/usr.bin/rpcgen/rpc_sample.c
@@ -270,6 +270,7 @@ write_sample_clnt_main(void)
version_list *vp;
f_print(fout, "\n\n");
+ f_print(fout, "int\n");
f_print(fout, "main(int argc, char *argv[])\n{\n");
f_print(fout, "\tchar *host;");
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 2062c68..6cdfcda 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -132,7 +132,7 @@ main(int argc, char *argv[])
fflag = 0;
inplace = NULL;
- while ((c = getopt(argc, argv, "EI:ae:f:i:lnr")) != -1)
+ while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
@@ -162,12 +162,16 @@ main(int argc, char *argv[])
ispan = 0; /* don't span across input files */
break;
case 'l':
- if(setlinebuf(stdout) != 0)
- warnx("setlinebuf() failed");
+ if(setvbuf(stdout, NULL, _IOLBF, 0) != 0)
+ warnx("setting line buffered output failed");
break;
case 'n':
nflag = 1;
break;
+ case 'u':
+ if(setvbuf(stdout, NULL, _IONBF, 0) != 0)
+ warnx("setting unbuffered output failed");
+ break;
default:
case '?':
usage();
@@ -199,9 +203,10 @@ main(int argc, char *argv[])
static void
usage(void)
{
- (void)fprintf(stderr, "%s\n%s\n",
- "usage: sed script [-Ealn] [-i extension] [file ...]",
- " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]");
+ (void)fprintf(stderr,
+ "usage: %s script [-Ealnru] [-i extension] [file ...]\n"
+ "\t%s [-Ealnu] [-i extension] [-e script] ... [-f script_file]"
+ " ... [file ...]\n", getprogname(), getprogname());
exit(1);
}
diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
index cf27496..955c277 100644
--- a/usr.bin/sed/sed.1
+++ b/usr.bin/sed/sed.1
@@ -31,7 +31,7 @@
.\" @(#)sed.1 8.2 (Berkeley) 12/30/93
.\" $FreeBSD$
.\"
-.Dd December 9, 2013
+.Dd June 20, 2014
.Dt SED 1
.Os
.Sh NAME
@@ -39,7 +39,7 @@
.Nd stream editor
.Sh SYNOPSIS
.Nm
-.Op Fl Ealnr
+.Op Fl Ealnru
.Ar command
.Op Ar
.Nm
@@ -148,6 +148,8 @@ option suppresses this behavior.
Same as
.Fl E
for compatibility with GNU sed.
+.It Fl u
+Make output unbuffered.
.El
.Pp
The form of a
@@ -618,7 +620,7 @@ command, written by
appeared in
.At v7 .
.Sh AUTHORS
-.An "Diomidis D. Spinellis" Aq dds@FreeBSD.org
+.An Diomidis D. Spinellis Aq Mt dds@FreeBSD.org
.Sh BUGS
Multibyte characters containing a byte with value 0x5C
.Tn ( ASCII
diff --git a/usr.bin/send-pr/Makefile b/usr.bin/send-pr/Makefile
new file mode 100644
index 0000000..2b422bf
--- /dev/null
+++ b/usr.bin/send-pr/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SCRIPTS= send-pr.sh
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/send-pr/send-pr.sh b/usr.bin/send-pr/send-pr.sh
new file mode 100755
index 0000000..ab59040
--- /dev/null
+++ b/usr.bin/send-pr/send-pr.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+echo
+echo "FreeBSD has migrated away from GNATS for tracking bugs, and so send-pr"
+echo "is no longer used for submitting bug reports."
+echo "Please see https://www.freebsd.org/support.html for more information."
+echo
+exit 1
diff --git a/usr.bin/showmount/showmount.8 b/usr.bin/showmount/showmount.8
index fe9f760..f49df84 100644
--- a/usr.bin/showmount/showmount.8
+++ b/usr.bin/showmount/showmount.8
@@ -40,7 +40,8 @@
.Sh SYNOPSIS
.Nm
.Op Fl a | d
-.Op Fl e3
+.Op Fl e
+.Op Fl 3
.Op Ar host
.Sh DESCRIPTION
The
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
index 8f744ed..b27a784 100644
--- a/usr.bin/sockstat/sockstat.1
+++ b/usr.bin/sockstat/sockstat.1
@@ -160,4 +160,4 @@ command appeared in
The
.Nm
command and this manual page were written by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
diff --git a/usr.bin/sort/Makefile.depend b/usr.bin/sort/Makefile.depend
index 7b75c5e..9679888 100644
--- a/usr.bin/sort/Makefile.depend
+++ b/usr.bin/sort/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.1 b/usr.bin/ssh-copy-id/ssh-copy-id.1
index b22c323..5974d03 100644
--- a/usr.bin/ssh-copy-id/ssh-copy-id.1
+++ b/usr.bin/ssh-copy-id/ssh-copy-id.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Feburary 28, 2014
+.Dd February 28, 2014
.Dt SSH-COPY-ID 1
.Os
.Sh NAME
@@ -85,6 +85,6 @@ To send a specific key to multiple hosts:
The
.Nm
utility was written by
-.An Eitan Adler Aq eadler@FreeBSD.org
+.An Eitan Adler Aq Mt eadler@FreeBSD.org
as a drop-in replacement for an existing utility included with
OpenSSH.
diff --git a/usr.bin/stat/stat.1 b/usr.bin/stat/stat.1
index eb8894c..96e1724 100644
--- a/usr.bin/stat/stat.1
+++ b/usr.bin/stat/stat.1
@@ -130,6 +130,7 @@ and use
.Xr fhstat 2
instead of
.Xr lstat 2 .
+This requires root privileges.
.It Fl L
Use
.Xr stat 2
@@ -600,8 +601,6 @@ and
The
.Nm
utility was written by
-.An Andrew Brown
-.Aq atatat@NetBSD.org .
+.An Andrew Brown Aq Mt atatat@NetBSD.org .
This man page was written by
-.An Jan Schaumann
-.Aq jschauma@NetBSD.org .
+.An Jan Schaumann Aq Mt jschauma@NetBSD.org .
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c
index 7b43882..120febe 100644
--- a/usr.bin/stat/stat.c
+++ b/usr.bin/stat/stat.c
@@ -186,6 +186,7 @@ int format1(const struct stat *, /* stat info */
char *, size_t, /* a place to put the output */
int, int, int, int, /* the parsed format */
int, int);
+int hex2byte(const char [2]);
#if HAVE_STRUCT_STAT_ST_FLAGS
char *xfflagstostr(unsigned long);
#endif
@@ -214,7 +215,7 @@ main(int argc, char *argv[])
lsF = 0;
fmtchar = '\0';
usestat = 0;
- nfs_handle = 0;
+ nfs_handle = 0;
nonl = 0;
quiet = 0;
linkfail = 0;
@@ -327,32 +328,27 @@ main(int argc, char *argv[])
rc = fstat(STDIN_FILENO, &st);
} else {
int j;
- char *inval;
file = argv[0];
if (nfs_handle) {
rc = 0;
- bzero (&fhnd, sizeof fhnd);
- j = MIN(2 * sizeof fhnd, strlen(file));
- if (j & 1) {
+ bzero(&fhnd, sizeof(fhnd));
+ j = MIN(2 * sizeof(fhnd), strlen(file));
+ if ((j & 1) != 0) {
rc = -1;
} else {
while (j) {
- ((char*) &fhnd)[j / 2 - 1] =
- strtol(&file[j - 2],
- &inval, 16);
- if (inval != NULL) {
- rc = -1;
+ rc = hex2byte(&file[j - 2]);
+ if (rc == -1)
break;
- }
- argv[0][j - 2] = '\0';
+ ((char*) &fhnd)[j / 2 - 1] = rc;
j -= 2;
}
- if (!rc)
- rc = fhstat(&fhnd, &st);
- else
- errno = EINVAL;
}
+ if (rc == -1)
+ errno = EINVAL;
+ else
+ rc = fhstat(&fhnd, &st);
} else if (usestat) {
/*
@@ -1091,3 +1087,12 @@ format1(const struct stat *st,
return (snprintf(buf, blen, lfmt, data));
}
+
+
+#define hex2nibble(c) (c <= '9' ? c - '0' : toupper(c) - 'A' + 10)
+int
+hex2byte(const char c[2]) {
+ if (!(ishexnumber(c[0]) && ishexnumber(c[1])))
+ return -1;
+ return (hex2nibble(c[0]) << 4) + hex2nibble(c[1]);
+}
diff --git a/usr.bin/svn/lib/libapr/Makefile b/usr.bin/svn/lib/libapr/Makefile
index 4504125..7dff95c 100644
--- a/usr.bin/svn/lib/libapr/Makefile
+++ b/usr.bin/svn/lib/libapr/Makefile
@@ -4,7 +4,7 @@
INTERNALLIB= yes
LIB= apr
-SRCS= apr_cpystrn.c apr_fnmatch.c apr_getpass.c apr_hash.c \
+SRCS= apr_cpystrn.c apr_fnmatch.c apr_getpass.c apr_hash.c apr_skiplist.c \
apr_pools.c apr_random.c apr_snprintf.c apr_strings.c \
apr_strnatcmp.c apr_strtok.c apr_tables.c buffer.c \
builtins.c charset.c common.c copy.c dir.c dso.c env.c \
@@ -18,7 +18,7 @@ SRCS= apr_cpystrn.c apr_fnmatch.c apr_getpass.c apr_hash.c \
shm.c signals.c sockaddr.c socket_util.c sockets.c \
sockopt.c solaris.c start.c tempdir.c thread.c thread_cond.c \
thread_mutex.c thread_rwlock.c threadpriv.c time.c \
- timestr.c userinfo.c version.c waitio.c
+ timestr.c userinfo.c version.c waitio.c z_asio.c
.PATH: ${APR}/atomic/unix ${APR}/dso/unix ${APR}/file_io/unix \
${APR}/locks/unix ${APR}/memory/unix ${APR}/misc/unix \
diff --git a/usr.bin/svn/lib/libapr/apr.h b/usr.bin/svn/lib/libapr/apr.h
index 37e7f83..867a72e 100644
--- a/usr.bin/svn/lib/libapr/apr.h
+++ b/usr.bin/svn/lib/libapr/apr.h
@@ -118,7 +118,7 @@
* or the extern "C" namespace
*/
-#if APR_HAVE_WINDOWS_H
+#if APR_HAVE_WINDOWS_H && defined(WIN32)
/* If windows.h was already included, our preferences don't matter.
* If not, include a restricted set of windows headers to our tastes.
*/
@@ -466,6 +466,8 @@ typedef apr_uint32_t apr_uintptr_t;
*/
#define APR_THREAD_FUNC
+#if defined(DOXYGEN) || !defined(WIN32)
+
/**
* The public APR functions are declared with APR_DECLARE(), so they may
* use the most appropriate calling convention. Public APR functions with
@@ -518,6 +520,20 @@ typedef apr_uint32_t apr_uintptr_t;
*/
#define APR_DECLARE_DATA
+#elif defined(APR_DECLARE_STATIC)
+#define APR_DECLARE(type) type __stdcall
+#define APR_DECLARE_NONSTD(type) type __cdecl
+#define APR_DECLARE_DATA
+#elif defined(APR_DECLARE_EXPORT)
+#define APR_DECLARE(type) __declspec(dllexport) type __stdcall
+#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
+#define APR_DECLARE_DATA __declspec(dllexport)
+#else
+#define APR_DECLARE(type) __declspec(dllimport) type __stdcall
+#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
+#define APR_DECLARE_DATA __declspec(dllimport)
+#endif
+
/* Define APR_SSIZE_T_FMT.
* If ssize_t is an integer we define it to be "d",
* if ssize_t is a long int we define it to be "ld",
diff --git a/usr.bin/svn/lib/libapr/apr_private.h b/usr.bin/svn/lib/libapr/apr_private.h
index 492a4f1..c5125a7 100644
--- a/usr.bin/svn/lib/libapr/apr_private.h
+++ b/usr.bin/svn/lib/libapr/apr_private.h
@@ -86,6 +86,9 @@
/* Define if accept4 function is supported */
#define HAVE_ACCEPT4 1
+/* Define if async i/o supports message q's */
+/* #undef HAVE_AIO_MSGQ */
+
/* Define to 1 if you have `alloca', as a function or macro. */
#define HAVE_ALLOCA 1
@@ -142,7 +145,7 @@
/* #undef HAVE_DL_H */
/* Define if dup3 function is supported */
-/* #undef HAVE_DUP3 */
+#define HAVE_DUP3 1
/* Define if EGD is supported */
/* #undef HAVE_EGD */
@@ -934,7 +937,7 @@
/* switch this on if we have a BeOS version below BONE */
-#if BEOS && !HAVE_BONE_VERSION
+#if defined(BEOS) && !defined(HAVE_BONE_VERSION)
#define BEOS_R5 1
#else
#define BEOS_BONE 1
diff --git a/usr.bin/svn/svn/Makefile b/usr.bin/svn/svn/Makefile
index dfa2e38..d6944f1 100644
--- a/usr.bin/svn/svn/Makefile
+++ b/usr.bin/svn/svn/Makefile
@@ -1,13 +1,13 @@
# $FreeBSD$
-MAN=
-
.include "${.CURDIR}/../Makefile.inc"
.PATH: ${SVNDIR}/svn
PROG= svn${SVNLITE}
+NO_PIE= yes
+
SRCS= add-cmd.c blame-cmd.c cat-cmd.c changelist-cmd.c checkout-cmd.c \
cl-conflicts.c cleanup-cmd.c commit-cmd.c conflict-callbacks.c \
copy-cmd.c delete-cmd.c deprecated.c diff-cmd.c export-cmd.c \
@@ -62,4 +62,8 @@ freebsd-organization.h:
> freebsd-organization.h
.endif
+svnlite.1: svn.1
+ # Avoid the website
+ sed -E 's,(^| |B|`)svn,\1svnlite,g' ${SVNDIR}/svn/svn.1 > ${.OBJDIR}/svnlite.1
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svn_private_config.h b/usr.bin/svn/svn_private_config.h
index 8d220d8..9e0ac15 100644
--- a/usr.bin/svn/svn_private_config.h
+++ b/usr.bin/svn/svn_private_config.h
@@ -105,7 +105,7 @@
#define PACKAGE_NAME "subversion"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "subversion 1.8.8"
+#define PACKAGE_STRING "subversion 1.8.9"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "subversion"
@@ -114,7 +114,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.8.8"
+#define PACKAGE_VERSION "1.8.9"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/usr.bin/svn/svnadmin/Makefile b/usr.bin/svn/svnadmin/Makefile
index 3220cde..c173d3b 100644
--- a/usr.bin/svn/svnadmin/Makefile
+++ b/usr.bin/svn/svnadmin/Makefile
@@ -34,4 +34,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svndumpfilter/Makefile b/usr.bin/svn/svndumpfilter/Makefile
index 864f376..6746735 100644
--- a/usr.bin/svn/svndumpfilter/Makefile
+++ b/usr.bin/svn/svndumpfilter/Makefile
@@ -34,4 +34,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnlook/Makefile b/usr.bin/svn/svnlook/Makefile
index 3d8b1a0..209b2f1 100644
--- a/usr.bin/svn/svnlook/Makefile
+++ b/usr.bin/svn/svnlook/Makefile
@@ -35,4 +35,6 @@ DPADD= ${LIBSVN_REPOS} ${LIBSVN_FS} ${LIBSVN_FS_FS} ${LIBSVN_FS_UTIL} \
${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} ${LIBAPR_UTIL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnmucc/Makefile b/usr.bin/svn/svnmucc/Makefile
index 23a98e3..34e706e 100644
--- a/usr.bin/svn/svnmucc/Makefile
+++ b/usr.bin/svn/svnmucc/Makefile
@@ -42,4 +42,6 @@ DPADD= ${LIBSVN_CLIENT} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} \
${LIBAPR_UTIL} ${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} \
${LIBCRYPT} ${LIBMAGIC} ${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnrdump/Makefile b/usr.bin/svn/svnrdump/Makefile
index afeae00..8a6a8fd 100644
--- a/usr.bin/svn/svnrdump/Makefile
+++ b/usr.bin/svn/svnrdump/Makefile
@@ -45,4 +45,6 @@ DPADD= ${LIBSVN_CLIENT} ${LIBSVN_WC} ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnserve/Makefile b/usr.bin/svn/svnserve/Makefile
index f1fa314..d21883c 100644
--- a/usr.bin/svn/svnserve/Makefile
+++ b/usr.bin/svn/svnserve/Makefile
@@ -41,4 +41,6 @@ DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnsync/Makefile b/usr.bin/svn/svnsync/Makefile
index a8cd380..db479c4 100644
--- a/usr.bin/svn/svnsync/Makefile
+++ b/usr.bin/svn/svnsync/Makefile
@@ -41,4 +41,6 @@ DPADD= ${LIBSVN_RA} ${LIBSVN_RA_LOCAL} ${LIBSVN_RA_SVN} ${LIBSVN_RA_SERF} \
${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} ${LIBZ} ${LIBCRYPT} ${LIBMAGIC} \
${LIBCRYPTO} ${LIBSSL} ${LIBPTHREAD}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/svn/svnversion/Makefile b/usr.bin/svn/svnversion/Makefile
index ca28ec3..54ce13c 100644
--- a/usr.bin/svn/svnversion/Makefile
+++ b/usr.bin/svn/svnversion/Makefile
@@ -32,4 +32,6 @@ DPADD= ${LIBSVN_WC} ${LIBSVN_DELTA} ${LIBSVN_DIFF} ${LIBSVN_SUBR} \
${LIBSERF} ${LIBAPR_UTIL} ${LIBBSDXML} ${LIBAPR} ${LIBSQLITE} \
${LIBZ} ${LIBCRYPT}
+NO_PIE= yes
+
.include <bsd.prog.mk>
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile
index 8d024ff..1bb2da0 100644
--- a/usr.bin/systat/Makefile
+++ b/usr.bin/systat/Makefile
@@ -16,16 +16,7 @@ CFLAGS+= -DINET6
WARNS?= 0
-DPADD= ${LIBM} ${LIBDEVSTAT} ${LIBKVM}
-LDADD= -lm -ldevstat -lkvm
-
-.if ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
-CFLAGS+= -DUSE_WIDECHAR
-DPADD+= ${LIBNCURSESW}
-LDADD+= -lncursesw
-.endif
+DPADD= ${LIBNCURSESW} ${LIBM} ${LIBDEVSTAT} ${LIBKVM}
+LDADD= -lncursesw -lm -ldevstat -lkvm
.include <bsd.prog.mk>
diff --git a/usr.bin/systat/ifstat.c b/usr.bin/systat/ifstat.c
index 1632890..4cfe01c 100644
--- a/usr.bin/systat/ifstat.c
+++ b/usr.bin/systat/ifstat.c
@@ -77,7 +77,7 @@ struct if_stat {
u_long if_in_pps_peak;
u_long if_out_pps_peak;
u_int if_row; /* Index into ifmib sysctl */
- u_int if_ypos; /* 0 if not being displayed */
+ int if_ypos; /* -1 if not being displayed */
u_int display;
u_int match;
};
@@ -210,13 +210,19 @@ showifstat(void)
struct if_stat *ifp = NULL;
SLIST_FOREACH(ifp, &curlist, link) {
- if (ifp->display == 0 || (ifp->match == 0) ||
- ifp->if_ypos > LINES - 3 - 1)
- continue;
- PUTNAME(ifp);
- PUTRATE(col2, ifp->if_ypos);
- PUTRATE(col3, ifp->if_ypos);
- PUTTOTAL(col4, ifp->if_ypos);
+ if (ifp->if_ypos < LINES - 3 && ifp->if_ypos != -1)
+ if (ifp->display == 0 || ifp->match == 0) {
+ wmove(wnd, ifp->if_ypos, 0);
+ wclrtoeol(wnd);
+ wmove(wnd, ifp->if_ypos + 1, 0);
+ wclrtoeol(wnd);
+ }
+ else {
+ PUTNAME(ifp);
+ PUTRATE(col2, ifp->if_ypos);
+ PUTRATE(col3, ifp->if_ypos);
+ PUTTOTAL(col4, ifp->if_ypos);
+ }
}
return;
@@ -425,6 +431,8 @@ sort_interface_list(void)
ifp->if_ypos = y;
y += ROW_SPACING;
}
+ else
+ ifp->if_ypos = -1;
}
needsort = 0;
@@ -476,14 +484,13 @@ cmdifstat(const char *cmd, const char *args)
retval = ifcmd(cmd, args);
/* ifcmd() returns 1 on success */
if (retval == 1) {
- showifstat();
- refresh();
if (needclear) {
+ showifstat();
+ refresh();
werase(wnd);
labelifstat();
needclear = 0;
}
}
-
return (retval);
}
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index 8417811..e0e627a 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -44,6 +44,7 @@ static const char copyright[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/sysctl.h>
+#include <sys/queue.h>
#include <err.h>
#include <limits.h>
@@ -53,6 +54,7 @@ static const char copyright[] =
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "systat.h"
@@ -77,21 +79,73 @@ int use_kvm = 1;
static WINDOW *wload; /* one line window for load average */
+struct cmdentry {
+ SLIST_ENTRY(cmdentry) link;
+ char *cmd; /* Command name */
+ char *argv; /* Arguments vector for a command */
+};
+SLIST_HEAD(, cmdentry) commands;
+
+static void
+parse_cmd_args (int argc, char **argv)
+{
+ int in_command = 0;
+ struct cmdentry *cmd = NULL;
+ double t;
+
+ while (argc) {
+ if (argv[0][0] == '-') {
+ if (in_command)
+ SLIST_INSERT_HEAD(&commands, cmd, link);
+
+ if (memcmp(argv[0], "--", 3) == 0) {
+ in_command = 0; /*-- ends a command explicitly*/
+ argc --, argv ++;
+ continue;
+ }
+ cmd = calloc(1, sizeof(struct cmdentry));
+ if (cmd == NULL)
+ errx(1, "memory allocating failure");
+ cmd->cmd = strdup(&argv[0][1]);
+ if (cmd->cmd == NULL)
+ errx(1, "memory allocating failure");
+ in_command = 1;
+ }
+ else if (!in_command) {
+ t = strtod(argv[0], NULL) * 1000000.0;
+ if (t > 0 && t < (double)UINT_MAX)
+ delay = (unsigned int)t;
+ }
+ else if (cmd != NULL) {
+ cmd->argv = strdup(argv[0]);
+ if (cmd->argv == NULL)
+ errx(1, "memory allocating failure");
+ in_command = 0;
+ SLIST_INSERT_HEAD(&commands, cmd, link);
+ }
+ else
+ errx(1, "invalid arguments list");
+
+ argc--, argv++;
+ }
+ if (in_command && cmd != NULL)
+ SLIST_INSERT_HEAD(&commands, cmd, link);
+
+}
+
int
main(int argc, char **argv)
{
char errbuf[_POSIX2_LINE_MAX], dummy;
size_t size;
double t;
+ struct cmdentry *cmd = NULL;
-#ifdef USE_WIDECHAR
(void) setlocale(LC_ALL, "");
-#else
- (void) setlocale(LC_TIME, "");
-#endif
+ SLIST_INIT(&commands);
argc--, argv++;
- while (argc > 0) {
+ if (argc > 0) {
if (argv[0][0] == '-') {
struct cmdtab *p;
@@ -101,12 +155,10 @@ main(int argc, char **argv)
if (p == (struct cmdtab *)0)
errx(1, "%s: unknown request", &argv[0][1]);
curcmd = p;
- } else {
- t = strtod(argv[0], NULL) * 1000000.0;
- if (t > 0 && t < (double)UINT_MAX)
- delay = (unsigned int)t;
+ argc--, argv++;
}
- argc--, argv++;
+ parse_cmd_args (argc, argv);
+
}
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
if (kd != NULL) {
@@ -169,8 +221,12 @@ main(int argc, char **argv)
curcmd->c_flags |= CF_INIT;
labels();
- dellave = 0.0;
+ if (curcmd->c_cmd != NULL)
+ SLIST_FOREACH (cmd, &commands, link)
+ if (!curcmd->c_cmd(cmd->cmd, cmd->argv))
+ warnx("command is not understood");
+ dellave = 0.0;
display();
noecho();
crmode();
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 9c144e7..5fc3257 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -37,6 +37,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl display
+.Op Ar display-commands
.Op Ar refresh-interval
.Sh DESCRIPTION
The
@@ -108,6 +109,23 @@ The
.Ar refresh-value
specifies the screen refresh time interval in seconds.
Time interval can be fractional.
+.It Ar display-commands
+A list of commands specific for this display. These commands can also
+be entered interactively and are described for each display separately
+below. If the command of the display requires an argument or arguments,
+it is possible to specify them as separate command line argument. To finish
+display commands it is possible to use double dash at the end
+of the list. For example:
+.Pp
+.Dl Nm Fl ifstat Fl match Ar bge0,em1 Fl pps
+.Pp
+This will display statistics of packets per second for network interfaces
+named as bge0 and em1.
+.Pp
+.Dl Nm Fl iostat Fl numeric Fl - Ar 2.1
+.Pp
+This will display all IO statistics in a numeric format and the information
+will be refreshed each 2.1 seconds.
.El
.Pp
Certain characters cause immediate action by
diff --git a/usr.bin/tabs/Makefile b/usr.bin/tabs/Makefile
index 4b5d40e..2c5f729 100644
--- a/usr.bin/tabs/Makefile
+++ b/usr.bin/tabs/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PROG= tabs
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.bin/tabs/Makefile.depend b/usr.bin/tabs/Makefile.depend
index 4f4df65..a25f5f6 100644
--- a/usr.bin/tabs/Makefile.depend
+++ b/usr.bin/tabs/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile
index d47bb91..a683f0a 100644
--- a/usr.bin/telnet/Makefile
+++ b/usr.bin/telnet/Makefile
@@ -13,6 +13,8 @@ SRCS= commands.c main.c network.c ring.c sys_bsd.c \
CFLAGS+= -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \
-I${TELNETDIR} -I${TELNETDIR}/libtelnet/
+NO_PIE= yes
+
.if ${MK_INET6_SUPPORT} != "no"
CFLAGS+= -DINET6
.endif
@@ -21,8 +23,8 @@ WARNS?= 2
LIBTELNET= ${.OBJDIR}/../../lib/libtelnet/libtelnet.a
-DPADD= ${LIBTERMCAP} ${LIBTELNET}
-LDADD= -ltermcap ${LIBTELNET}
+DPADD= ${LIBTERMCAPW} ${LIBTELNET}
+LDADD= -ltermcapw ${LIBTELNET}
.if !defined(RELEASE_CRUNCH)
CFLAGS+= -DIPSEC
@@ -34,7 +36,6 @@ SRCS+= genget.c getent.c misc.c
CFLAGS+= -DHAS_CGETENT
.endif
-.if !defined(RELEASE_CRUNCH)
.if ${MK_OPENSSL} != "no"
SRCS+= authenc.c
CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DIPSEC
@@ -47,6 +48,5 @@ CFLAGS+= -DKRB5 -DFORWARD -Dnet_write=telnet_net_write
DPADD+= ${LIBKRB5} ${LIBHX509} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN}
LDADD+= -lkrb5 -lhx509 -lasn1 -lcom_err -lroken
.endif
-.endif
.include <bsd.prog.mk>
diff --git a/usr.bin/telnet/Makefile.depend b/usr.bin/telnet/Makefile.depend
index 6da6466..0bc9047 100644
--- a/usr.bin/telnet/Makefile.depend
+++ b/usr.bin/telnet/Makefile.depend
@@ -25,7 +25,6 @@ DIRDEPS = \
lib/libpam/libpam \
lib/libtelnet \
lib/libthr \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
secure/lib/libcrypto \
diff --git a/usr.bin/tftp/Makefile b/usr.bin/tftp/Makefile
index 7521e4e..88f8c37 100644
--- a/usr.bin/tftp/Makefile
+++ b/usr.bin/tftp/Makefile
@@ -7,7 +7,7 @@ PROG= tftp
SRCS= main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c
SRCS+= tftp-utils.c tftp.c
CFLAGS+=-I${.CURDIR}/../../libexec/tftpd
-DPADD= ${LIBEDIT} ${LIBTERMCAP}
-LDADD= -ledit -ltermcap
+DPADD= ${LIBEDIT} ${LIBTERMCAPW}
+LDADD= -ledit -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.bin/tftp/Makefile.depend b/usr.bin/tftp/Makefile.depend
index a0d576d..abbcdbc 100644
--- a/usr.bin/tftp/Makefile.depend
+++ b/usr.bin/tftp/Makefile.depend
@@ -12,7 +12,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.bin/timeout/Makefile b/usr.bin/timeout/Makefile
new file mode 100644
index 0000000..46ca6e3
--- /dev/null
+++ b/usr.bin/timeout/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG= timeout
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/timeout/Makefile.depend b/usr.bin/timeout/Makefile.depend
new file mode 100644
index 0000000..96aa2a2
--- /dev/null
+++ b/usr.bin/timeout/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1
new file mode 100644
index 0000000..028fc62
--- /dev/null
+++ b/usr.bin/timeout/timeout.1
@@ -0,0 +1,114 @@
+.\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2014
+.Dt TIMEOUT 1
+.Os
+.Sh NAME
+.Nm timeout
+.Nd run a command with a time limit
+.Sh SYNOPSIS
+.Nm
+.Op Fl -signal Ar sig | Fl s Ar sig
+.Op Fl -preserve-status
+.Op Fl -kill-after Ar time | Fl k Ar time
+.Op Fl -foreground
+.Ao Ar duration Ac
+.Ao Ar command Ac
+.Ao Ar args ... Ac
+.Sh DESCRIPTION
+.Nm
+starts the
+.Ar command
+with its
+.Ar args.
+If
+.Ar command
+is still running after
+.Ar duration ,
+it is killed.
+By default,
+.Ar SIGTERM.
+is sent.
+.Bl -tag -width "-k time, --kill-after time"
+.It Fl -preserve-status
+Always exits with the same status as
+.Ar command
+even if it times out.
+.It Fl -foreground
+Do not propagate timeout to the
+.Ar command
+children.
+.It Fl s Ar sig , Fl -signal Ar sig
+Specify the signal to send on timeout.
+By default,
+.Ar SIGTERM .
+is sent.
+.It Fl k Ar time , Fl -kill-after Ar time
+Send a second kill signal if
+.Ar command
+is still running after
+.Ar time
+after the first signal was sent.
+.El
+.Sh DURATION FORMAT
+.Ar duration
+and
+.Ar time
+can be integer or decimal numbers.
+Values without unit symbols are interpreted as seconds.
+.Pp
+Supported unit symbols are:
+.Bl -tag -width indent -compact
+.It s
+seconds
+.It m
+minutes
+.It h
+hours
+.It d
+days
+.El
+.Sh EXIT STATUS
+If the timeout was not reached, the exit status of
+.Ar command
+is returned.
+.Pp
+If the timeout was reached and
+.Fl -preserve-status
+is set, the exit status of
+.Ar command
+is returned.
+If
+.Fl -preserve-status
+is not set, an exit status of 124 is returned.
+.Pp
+If
+.Ar command
+exits after receiving a signal, the exit status returned is the signal number plus 128.
+.Sh SEE ALSO
+.Xr kill 1 ,
+.Xr signal 3
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
new file mode 100644
index 0000000..8171600
--- /dev/null
+++ b/usr.bin/timeout/timeout.c
@@ -0,0 +1,333 @@
+/*-
+ * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
+ * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#define EXIT_TIMEOUT 124
+
+static sig_atomic_t sig_chld = 0;
+static sig_atomic_t sig_term = 0;
+static sig_atomic_t sig_alrm = 0;
+static sig_atomic_t sig_ign = 0;
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "Usage: %s [--signal sig | -s sig] [--preserve-status]"
+ " [--kill-after time | -k time] [--foreground] <duration> <command>"
+ " <arg ...>\n", getprogname());
+
+ exit(EX_USAGE);
+}
+
+static double
+parse_duration(const char *duration)
+{
+ double ret;
+ char *end;
+
+ ret = strtod(duration, &end);
+ if (ret == 0 && end == duration)
+ errx(EXIT_FAILURE, "invalid duration");
+
+ if (end == NULL || *end == '\0')
+ return (ret);
+
+ if (end != NULL && *(end + 1) != '\0')
+ errx(EX_USAGE, "invalid duration");
+
+ switch (*end) {
+ case 's':
+ break;
+ case 'm':
+ ret *= 60;
+ break;
+ case 'h':
+ ret *= 60 * 60;
+ break;
+ case 'd':
+ ret *= 60 * 60 * 24;
+ break;
+ default:
+ errx(EX_USAGE, "invalid duration");
+ }
+
+ if (ret < 0 || ret >= 100000000UL)
+ errx(EX_USAGE, "invalid duration");
+
+ return (ret);
+}
+
+static int
+parse_signal(const char *str)
+{
+ int sig, i;
+ const char *errstr;
+
+ sig = strtonum(str, 0, sys_nsig, &errstr);
+
+ if (errstr == NULL)
+ return (sig);
+ if (strncasecmp(str, "SIG", 3) == 0)
+ str += 3;
+
+ for (i = 1; i < sys_nsig; i++) {
+ if (strcasecmp(str, sys_signame[i]) == 0)
+ return (i);
+ }
+
+ errx(EX_USAGE, "invalid signal");
+}
+
+static void
+sig_handler(int signo)
+{
+ if (sig_ign != 0 && signo == sig_ign) {
+ sig_ign = 0;
+ return;
+ }
+
+ switch(signo) {
+ case 0:
+ case SIGINT:
+ case SIGHUP:
+ case SIGQUIT:
+ case SIGTERM:
+ sig_term = signo;
+ break;
+ case SIGCHLD:
+ sig_chld = 1;
+ break;
+ case SIGALRM:
+ sig_alrm = 1;
+ break;
+ }
+}
+
+static void
+set_interval(double iv)
+{
+ struct itimerval tim;
+
+ memset(&tim, 0, sizeof(tim));
+ tim.it_value.tv_sec = (time_t)iv;
+ iv -= (time_t)iv;
+ tim.it_value.tv_usec = (suseconds_t)(iv * 1000000UL);
+
+ if (setitimer(ITIMER_REAL, &tim, NULL) == -1)
+ err(EX_OSERR, "setitimer()");
+}
+
+int
+main(int argc, char **argv)
+{
+ int ch;
+ unsigned long i;
+ int foreground, preserve;
+ int error, pstat, status;
+ int killsig = SIGTERM;
+ pid_t pgid, pid, cpid;
+ double first_kill;
+ double second_kill;
+ bool timedout = false;
+ bool do_second_kill = false;
+ struct sigaction signals;
+ int signums[] = {
+ -1,
+ SIGTERM,
+ SIGINT,
+ SIGHUP,
+ SIGCHLD,
+ SIGALRM,
+ SIGQUIT,
+ };
+
+ foreground = preserve = 0;
+ second_kill = 0;
+ cpid = -1;
+ pgid = -1;
+
+ const struct option longopts[] = {
+ { "preserve-status", no_argument, &preserve, 1 },
+ { "foreground", no_argument, &foreground, 1 },
+ { "kill-after", required_argument, NULL, 'k'},
+ { "signal", required_argument, NULL, 's'},
+ { "help", no_argument, NULL, 'h'},
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((ch = getopt_long(argc, argv, "+k:s:h", longopts, NULL)) != -1) {
+ switch (ch) {
+ case 'k':
+ do_second_kill = true;
+ second_kill = parse_duration(optarg);
+ break;
+ case 's':
+ killsig = parse_signal(optarg);
+ break;
+ case 0:
+ break;
+ case 'h':
+ default:
+ usage();
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 2)
+ usage();
+
+ first_kill = parse_duration(argv[0]);
+ argc--;
+ argv++;
+
+ if (!foreground) {
+ pgid = setpgid(0,0);
+
+ if (pgid == -1)
+ err(EX_OSERR, "setpgid()");
+ }
+
+ memset(&signals, 0, sizeof(signals));
+ sigemptyset(&signals.sa_mask);
+
+ if (killsig != SIGKILL && killsig != SIGSTOP)
+ signums[0] = killsig;
+
+ for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++)
+ sigaddset(&signals.sa_mask, signums[i]);
+
+ signals.sa_handler = sig_handler;
+ signals.sa_flags = SA_RESTART;
+
+ for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i ++)
+ if (signums[i] != -1 && signums[i] != 0 &&
+ sigaction(signums[i], &signals, NULL) == -1)
+ err(EX_OSERR, "sigaction()");
+
+ signal(SIGTTIN, SIG_IGN);
+ signal(SIGTTOU, SIG_IGN);
+
+ pid = fork();
+ if (pid == -1)
+ err(EX_OSERR, "fork()");
+ else if (pid == 0) {
+ /* child process */
+ signal(SIGTTIN, SIG_DFL);
+ signal(SIGTTOU, SIG_DFL);
+
+ error = execvp(argv[0], argv);
+ if (error == -1)
+ err(EX_UNAVAILABLE, "exec()");
+ }
+
+ if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1)
+ err(EX_OSERR, "sigprocmask()");
+
+ /* parent continues here */
+ set_interval(first_kill);
+
+ for (;;) {
+ sigemptyset(&signals.sa_mask);
+ sigsuspend(&signals.sa_mask);
+
+ if (sig_chld) {
+ sig_chld = 0;
+ while (((cpid = wait(&status)) < 0) && errno == EINTR)
+ continue;
+
+ if (cpid == pid) {
+ pstat = status;
+ break;
+ }
+ } else if (sig_alrm) {
+ sig_alrm = 0;
+
+ timedout = true;
+ if (!foreground)
+ killpg(pgid, killsig);
+ else
+ kill(pid, killsig);
+
+ if (do_second_kill) {
+ set_interval(second_kill);
+ second_kill = 0;
+ sig_ign = killsig;
+ killsig = SIGKILL;
+ } else
+ break;
+
+ } else if (sig_term) {
+ if (!foreground)
+ killpg(pgid, killsig);
+ else
+ kill(pid, sig_term);
+
+ if (do_second_kill) {
+ set_interval(second_kill);
+ second_kill = 0;
+ sig_ign = killsig;
+ killsig = SIGKILL;
+ } else
+ break;
+ }
+ }
+
+ while (cpid != pid && wait(&pstat) == -1) {
+ if (errno != EINTR)
+ err(EX_OSERR, "waitpid()");
+ }
+
+ if (WEXITSTATUS(pstat))
+ pstat = WEXITSTATUS(pstat);
+ else if(WIFSIGNALED(pstat))
+ pstat = 128 + WTERMSIG(pstat);
+
+ if (timedout && !preserve)
+ pstat = EXIT_TIMEOUT;
+
+ return (pstat);
+}
diff --git a/usr.bin/top/Makefile.depend b/usr.bin/top/Makefile.depend
index 90e81ac..e5ee6d3 100644
--- a/usr.bin/top/Makefile.depend
+++ b/usr.bin/top/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index cf4714c..de57b94 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -96,6 +96,7 @@ struct handle {
#define RUTOT(pp) \
(RU(pp)->ru_inblock + RU(pp)->ru_oublock + RU(pp)->ru_majflt)
+#define PCTCPU(pp) (pcpu[pp - pbase])
/* definitions for indices in the nlist array */
@@ -203,7 +204,14 @@ static struct kinfo_proc *previous_procs;
static struct kinfo_proc **previous_pref;
static int previous_proc_count = 0;
static int previous_proc_count_max = 0;
-static int arc_enabled;
+static int previous_thread;
+
+/* data used for recalculating pctcpu */
+static double *pcpu;
+static struct timespec proc_uptime;
+static struct timeval proc_wall_time;
+static struct timeval previous_wall_time;
+static uint64_t previous_interval = 0;
/* total number of io operations */
static long total_inblock;
@@ -212,6 +220,7 @@ static long total_majflt;
/* these are for getting the memory statistics */
+static int arc_enabled;
static int pageshift; /* log base 2 of the pagesize */
/* define pagetok in terms of pageshift */
@@ -329,6 +338,7 @@ machine_init(struct statics *statics, char do_unames)
pbase = NULL;
pref = NULL;
+ pcpu = NULL;
nproc = 0;
onproc = -1;
@@ -650,6 +660,52 @@ get_io_stats(struct kinfo_proc *pp, long *inp, long *oup, long *flp,
}
/*
+ * If there was a previous update, use the delta in ki_runtime over
+ * the previous interval to calculate pctcpu. Otherwise, fall back
+ * to using the kernel's ki_pctcpu.
+ */
+static double
+proc_calc_pctcpu(struct kinfo_proc *pp)
+{
+ const struct kinfo_proc *oldp;
+
+ if (previous_interval != 0) {
+ oldp = get_old_proc(pp);
+ if (oldp != NULL)
+ return ((double)(pp->ki_runtime - oldp->ki_runtime)
+ / previous_interval);
+
+ /*
+ * If this process/thread was created during the previous
+ * interval, charge it's total runtime to the previous
+ * interval.
+ */
+ else if (pp->ki_start.tv_sec > previous_wall_time.tv_sec ||
+ (pp->ki_start.tv_sec == previous_wall_time.tv_sec &&
+ pp->ki_start.tv_usec >= previous_wall_time.tv_usec))
+ return ((double)pp->ki_runtime / previous_interval);
+ }
+ return (pctdouble(pp->ki_pctcpu));
+}
+
+/*
+ * Return true if this process has used any CPU time since the
+ * previous update.
+ */
+static int
+proc_used_cpu(struct kinfo_proc *pp)
+{
+ const struct kinfo_proc *oldp;
+
+ oldp = get_old_proc(pp);
+ if (oldp == NULL)
+ return (PCTCPU(pp) != 0);
+ return (pp->ki_runtime != oldp->ki_runtime ||
+ RU(pp)->ru_nvcsw != RU(oldp)->ru_nvcsw ||
+ RU(pp)->ru_nivcsw != RU(oldp)->ru_nivcsw);
+}
+
+/*
* Return the total number of block in/out and faults by a process.
*/
long
@@ -670,9 +726,11 @@ get_process_info(struct system_info *si, struct process_select *sel,
int total_procs;
long p_io;
long p_inblock, p_oublock, p_majflt, p_vcsw, p_ivcsw;
+ long nsec;
int active_procs;
struct kinfo_proc **prefp;
struct kinfo_proc *pp;
+ struct timespec previous_proc_uptime;
/* these are copied out of sel for speed */
int show_idle;
@@ -684,6 +742,13 @@ get_process_info(struct system_info *si, struct process_select *sel,
int show_kidle;
/*
+ * If thread state was toggled, don't cache the previous processes.
+ */
+ if (previous_thread != sel->thread)
+ nproc = 0;
+ previous_thread = sel->thread;
+
+ /*
* Save the previous process info.
*/
if (previous_proc_count_max < nproc) {
@@ -705,12 +770,32 @@ get_process_info(struct system_info *si, struct process_select *sel,
ps.thread ? compare_tid : compare_pid);
}
previous_proc_count = nproc;
+ previous_proc_uptime = proc_uptime;
+ previous_wall_time = proc_wall_time;
+ previous_interval = 0;
pbase = kvm_getprocs(kd, sel->thread ? KERN_PROC_ALL : KERN_PROC_PROC,
0, &nproc);
- if (nproc > onproc)
- pref = realloc(pref, sizeof(*pref) * (onproc = nproc));
- if (pref == NULL || pbase == NULL) {
+ (void)gettimeofday(&proc_wall_time, NULL);
+ if (clock_gettime(CLOCK_UPTIME, &proc_uptime) != 0)
+ memset(&proc_uptime, 0, sizeof(proc_uptime));
+ else if (previous_proc_uptime.tv_sec != 0 &&
+ previous_proc_uptime.tv_nsec != 0) {
+ previous_interval = (proc_uptime.tv_sec -
+ previous_proc_uptime.tv_sec) * 1000000;
+ nsec = proc_uptime.tv_nsec - previous_proc_uptime.tv_nsec;
+ if (nsec < 0) {
+ previous_interval -= 1000000;
+ nsec += 1000000000;
+ }
+ previous_interval += nsec / 1000;
+ }
+ if (nproc > onproc) {
+ pref = realloc(pref, sizeof(*pref) * nproc);
+ pcpu = realloc(pcpu, sizeof(*pcpu) * nproc);
+ onproc = nproc;
+ }
+ if (pref == NULL || pbase == NULL || pcpu == NULL) {
(void) fprintf(stderr, "top: Out of memory.\n");
quit(23);
}
@@ -763,9 +848,12 @@ get_process_info(struct system_info *si, struct process_select *sel,
if (!show_kidle && pp->ki_tdflags & TDF_IDLETD)
/* skip kernel idle process */
continue;
-
+
+ PCTCPU(pp) = proc_calc_pctcpu(pp);
+ if (sel->thread && PCTCPU(pp) > 1.0)
+ PCTCPU(pp) = 1.0;
if (displaymode == DISP_CPU && !show_idle &&
- (pp->ki_pctcpu == 0 ||
+ (!proc_used_cpu(pp) ||
pp->ki_stat == SSTOP || pp->ki_stat == SIDL))
/* skip idle or non-running processes */
continue;
@@ -848,7 +936,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
cputime = (pp->ki_runtime + 500000) / 1000000;
/* calculate the base for cpu percentages */
- pct = pctdouble(pp->ki_pctcpu);
+ pct = PCTCPU(pp);
/* generate "STATE" field */
switch (state = pp->ki_stat) {
@@ -916,7 +1004,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
argbuflen = cmdlen * 4;
argbuf = (char *)malloc(argbuflen + 1);
if (argbuf == NULL) {
- warn("malloc(%d)", argbuflen + 1);
+ warn("malloc(%zd)", argbuflen + 1);
free(cmdbuf);
return NULL;
}
@@ -1023,7 +1111,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
thr_buf[0] = '\0';
else
snprintf(thr_buf, sizeof(thr_buf), "%*d ",
- sizeof(thr_buf) - 2, pp->ki_numthreads);
+ (int)(sizeof(thr_buf) - 2), pp->ki_numthreads);
snprintf(fmt, sizeof(fmt), proc_fmt,
pp->ki_pid,
@@ -1169,14 +1257,12 @@ static int sorted_state[] = {
#define ORDERKEY_PCTCPU(a, b) do { \
- long diff; \
+ double diff; \
if (ps.wcpu) \
- diff = floor(1.0E6 * weighted_cpu(pctdouble((b)->ki_pctcpu), \
- (b))) - \
- floor(1.0E6 * weighted_cpu(pctdouble((a)->ki_pctcpu), \
- (a))); \
+ diff = weighted_cpu(PCTCPU((b)), (b)) - \
+ weighted_cpu(PCTCPU((a)), (a)); \
else \
- diff = (long)(b)->ki_pctcpu - (long)(a)->ki_pctcpu; \
+ diff = PCTCPU((b)) - PCTCPU((a)); \
if (diff != 0) \
return (diff > 0 ? 1 : -1); \
} while (0)
diff --git a/usr.bin/tput/Makefile b/usr.bin/tput/Makefile
index 143dc65..c42ef79 100644
--- a/usr.bin/tput/Makefile
+++ b/usr.bin/tput/Makefile
@@ -2,8 +2,8 @@
# $FreeBSD$
PROG= tput
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
SCRIPTS=clear.sh
MLINKS= tput.1 clear.1
diff --git a/usr.bin/tput/Makefile.depend b/usr.bin/tput/Makefile.depend
index 4f4df65..a25f5f6 100644
--- a/usr.bin/tput/Makefile.depend
+++ b/usr.bin/tput/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/truncate/Makefile b/usr.bin/truncate/Makefile
index 1b24d35..b51c9b0 100644
--- a/usr.bin/truncate/Makefile
+++ b/usr.bin/truncate/Makefile
@@ -1,7 +1,13 @@
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= truncate
DPADD= ${LIBUTIL}
LDADD= -lutil
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/truncate/tests/Makefile b/usr.bin/truncate/tests/Makefile
new file mode 100644
index 0000000..bfa15db
--- /dev/null
+++ b/usr.bin/truncate/tests/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/truncate
+ATF_TESTS_SH= truncate_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/truncate/tests/truncate_test.sh b/usr.bin/truncate/tests/truncate_test.sh
new file mode 100644
index 0000000..e66f48a
--- /dev/null
+++ b/usr.bin/truncate/tests/truncate_test.sh
@@ -0,0 +1,402 @@
+#
+# Copyright 2014, Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+# Helper function that is always used to create and fill stderr.txt for these
+# tests.
+_custom_create_file()
+{
+ # The first argument is a command.
+ # The second is just a string.
+ case "${1}" in
+ creat) > stderr.txt ;;
+ print) [ "${2}" ] && \
+ printf "%s\n" "${2}" >> stderr.txt ;;
+ esac
+}
+
+# Helper function that create the file stderr.txt that contains the string
+# passed in as the first argument.
+create_stderr_file()
+{
+ _custom_create_file creat
+ _custom_create_file print "${1}"
+}
+
+# Helper function that create the file stderr.txt that contains the expected
+# truncate utility usage message.
+create_stderr_usage_file()
+{
+ _custom_create_file creat
+ _custom_create_file print "${1}"
+ _custom_create_file print \
+ "usage: truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ..."
+ _custom_create_file print " truncate [-c] -r rfile file ..."
+}
+
+atf_test_case illegal_option
+illegal_option_head()
+{
+ atf_set "descr" "Verifies that truncate exits >0 when passed an" \
+ "invalid command line option"
+}
+illegal_option_body()
+{
+ create_stderr_usage_file 'truncate: illegal option -- 7'
+
+ # We expect the error message, with no new files.
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -7 -s0 output.txt
+ [ ! -e output.txt ] || atf_fail "output.txt should not exist"
+}
+
+atf_test_case illegal_size
+illegal_size_head()
+{
+ atf_set "descr" "Verifies that truncate exits >0 when passed an" \
+ "invalid power of two convention"
+}
+illegal_size_body()
+{
+ create_stderr_file "truncate: invalid size argument \`+1L'"
+
+ # We expect the error message, with no new files.
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -s+1L output.txt
+ [ ! -e output.txt ] || atf_fail "output.txt should not exist"
+}
+
+atf_test_case too_large_size
+too_large_size_head()
+{
+ atf_set "descr" "Verifies that truncate exits >0 when passed an" \
+ "a size that is INT64_MAX < size <= UINT64_MAX"
+}
+too_large_size_body()
+{
+ create_stderr_file "truncate: invalid size argument \`8388608t'"
+
+ # We expect the error message, with no new files.
+ atf_check -s not-exit:0 -e file:stderr.txt \
+ truncate -s8388608t output.txt
+ [ ! -e output.txt ] || atf_fail "output.txt should not exist"
+}
+
+atf_test_case opt_c
+opt_c_head()
+{
+ atf_set "descr" "Verifies that -c prevents creation of new files"
+}
+opt_c_body()
+{
+ # No new files and truncate returns 0 as if this is a success.
+ atf_check truncate -c -s 0 doesnotexist.txt
+ [ ! -e output.txt ] || atf_fail "doesnotexist.txt should not exist"
+ > reference
+ atf_check truncate -c -r reference doesnotexist.txt
+ [ ! -e output.txt ] || atf_fail "doesnotexist.txt should not exist"
+
+ create_stderr_file
+
+ # The existing file will be altered by truncate.
+ > exists.txt
+ atf_check -e file:stderr.txt truncate -c -s1 exists.txt
+ [ -s exists.txt ] || atf_fail "exists.txt be larger than zero bytes"
+}
+
+atf_test_case opt_rs
+opt_rs_head()
+{
+ atf_set "descr" "Verifies that truncate command line flags" \
+ "-s and -r cannot be specifed together"
+}
+opt_rs_body()
+{
+ create_stderr_usage_file
+
+ # Force an error due to the use of both -s and -r.
+ > afile
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -s0 -r afile afile
+}
+
+atf_test_case no_files
+no_files_head()
+{
+ atf_set "descr" "Verifies that truncate needs a list of files on" \
+ "the command line"
+}
+no_files_body()
+{
+ create_stderr_usage_file
+
+ # A list of files must be present on the command line.
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -s1
+}
+
+atf_test_case bad_refer
+bad_refer_head()
+{
+ atf_set "descr" "Verifies that truncate detects a non-existent" \
+ "reference file"
+}
+bad_refer_body()
+{
+ create_stderr_file "truncate: afile: No such file or directory"
+
+ # The reference file must exist before you try to use it.
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -r afile afile
+ [ ! -e afile ] || atf_fail "afile should not exist"
+}
+
+atf_test_case bad_truncate cleanup
+bad_truncate_head()
+{
+ atf_set "descr" "Verifies that truncate reports an error during" \
+ "truncation"
+}
+bad_truncate_body()
+{
+ create_stderr_file "truncate: exists.txt: Operation not permitted"
+
+ # Trying to get the ftruncate() call to return -1.
+ > exists.txt
+ atf_check chflags uimmutable exists.txt
+
+ atf_check -s not-exit:0 -e file:stderr.txt truncate -s1 exists.txt
+}
+bad_truncate_cleanup()
+{
+ chflags 0 exists.txt
+}
+
+atf_test_case new_absolute_grow
+new_absolute_grow_head()
+{
+ atf_set "descr" "Verifies truncate can make and grow a new 1m file"
+}
+new_absolute_grow_body()
+{
+ create_stderr_file
+
+ # Create a new file and grow it to 1024 bytes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s1k output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+
+ create_stderr_file
+
+ # Grow the existing file to 1M. We are using absolute sizes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -c -s1M output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1048576 ] || atf_fail "expected file size of 1m"
+}
+
+atf_test_case new_absolute_shrink
+new_absolute_shrink_head()
+{
+ atf_set "descr" "Verifies that truncate can make and" \
+ "shrink a new 1m file"
+}
+new_absolute_shrink_body()
+{
+ create_stderr_file
+
+ # Create a new file and grow it to 1048576 bytes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s1M output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1048576 ] || atf_fail "expected file size of 1m"
+
+ create_stderr_file
+
+ # Shrink the existing file to 1k. We are using absolute sizes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s1k output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+}
+
+atf_test_case new_relative_grow
+new_relative_grow_head()
+{
+ atf_set "descr" "Verifies truncate can make and grow a new 1m file" \
+ "using relative sizes"
+}
+new_relative_grow_body()
+{
+ create_stderr_file
+
+ # Create a new file and grow it to 1024 bytes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s+1k output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+
+ create_stderr_file
+
+ # Grow the existing file to 1M. We are using relative sizes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s+1047552 output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1048576 ] || atf_fail "expected file size of 1m"
+}
+
+atf_test_case new_relative_shrink
+new_relative_shrink_head()
+{
+ atf_set "descr" "Verifies truncate can make and shrink a new 1m file" \
+ "using relative sizes"
+}
+new_relative_shrink_body()
+{
+ create_stderr_file
+
+ # Create a new file and grow it to 1049600 bytes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s+1049600 output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1049600 ] || atf_fail "expected file size of 1m"
+
+ create_stderr_file
+
+ # Shrink the existing file to 1k. We are using relative sizes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s-1M output.txt
+ atf_check -s exit:1 cmp -s output.txt /dev/zero
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+}
+
+atf_test_case cannot_open
+cannot_open_head()
+{
+ atf_set "descr" "Verifies truncate handles open failures correctly" \
+ "in a list of files"
+ atf_set "require.user" "unprivileged"
+}
+cannot_open_body()
+{
+ # Create three files -- the middle file cannot allow writes.
+ > before
+ > 0000
+ > after
+ atf_check chmod 0000 0000
+
+ create_stderr_file "truncate: 0000: Permission denied"
+
+ # Create a new file and grow it to 1024 bytes.
+ atf_check -s not-exit:0 -e file:stderr.txt \
+ truncate -c -s1k before 0000 after
+ eval $(stat -s before)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+ eval $(stat -s after)
+ [ ${st_size} -eq 1024 ] || atf_fail "expected file size of 1k"
+ eval $(stat -s 0000)
+ [ ${st_size} -eq 0 ] || atf_fail "expected file size of zero"
+}
+
+atf_test_case reference
+reference_head()
+{
+ atf_set "descr" "Verifies that truncate can use a reference file"
+}
+reference_body()
+{
+ # Create a 4 byte reference file.
+ printf "123\n" > reference
+ eval $(stat -s reference)
+ [ ${st_size} -eq 4 ] || atf_fail "reference file should be 4 bytes"
+
+ create_stderr_file
+
+ # Create a new file and grow it to 4 bytes.
+ atf_check -e file:stderr.txt truncate -r reference afile
+ eval $(stat -s afile)
+ [ ${st_size} -eq 4 ] || atf_fail "new file should also be 4 bytes"
+}
+
+atf_test_case new_zero
+new_zero_head()
+{
+ atf_set "descr" "Verifies truncate can make and grow zero byte file"
+}
+new_zero_body()
+{
+ create_stderr_file
+
+ # Create a new file and grow it to zero bytes.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s0 output.txt
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 0 ] || atf_fail "expected file size of zero"
+
+ # Pretend to grow the file.
+ atf_check -s exit:0 -e file:stderr.txt truncate -s+0 output.txt
+ eval $(stat -s output.txt)
+ [ ${st_size} -eq 0 ] || atf_fail "expected file size of zero"
+}
+
+atf_test_case negative
+negative_head()
+{
+ atf_set "descr" "Verifies truncate treats negative sizes as zero"
+}
+negative_body()
+{
+ # Create a 5 byte file.
+ printf "abcd\n" > afile
+ eval $(stat -s afile)
+ [ ${st_size} -eq 5 ] || atf_fail "afile file should be 5 bytes"
+
+ create_stderr_file
+
+ # Create a new file and do a 100 byte negative relative shrink.
+ atf_check -e file:stderr.txt truncate -s-100 afile
+ eval $(stat -s afile)
+ [ ${st_size} -eq 0 ] || atf_fail "new file should now be zero bytes"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case illegal_option
+ atf_add_test_case illegal_size
+ atf_add_test_case too_large_size
+ atf_add_test_case opt_c
+ atf_add_test_case opt_rs
+ atf_add_test_case no_files
+ atf_add_test_case bad_refer
+ atf_add_test_case bad_truncate
+ atf_add_test_case cannot_open
+ atf_add_test_case new_absolute_grow
+ atf_add_test_case new_absolute_shrink
+ atf_add_test_case new_relative_grow
+ atf_add_test_case new_relative_shrink
+ atf_add_test_case reference
+ atf_add_test_case new_zero
+ atf_add_test_case negative
+}
diff --git a/usr.bin/truncate/truncate.1 b/usr.bin/truncate/truncate.1
index 827097c..117fe70 100644
--- a/usr.bin/truncate/truncate.1
+++ b/usr.bin/truncate/truncate.1
@@ -149,5 +149,4 @@ utility first appeared in
The
.Nm
utility was written by
-.An Sheldon Hearn
-.Aq sheldonh@starjuice.net .
+.An Sheldon Hearn Aq Mt sheldonh@starjuice.net .
diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c
index 12b81af..d45533e 100644
--- a/usr.bin/truncate/truncate.c
+++ b/usr.bin/truncate/truncate.c
@@ -54,8 +54,8 @@ main(int argc, char **argv)
{
struct stat sb;
mode_t omode;
- off_t oflow, rsize, tsize;
- int64_t sz;
+ off_t oflow, rsize, sz, tsize;
+ uint64_t usz;
int ch, error, fd, oflags;
char *fname, *rname;
@@ -73,11 +73,13 @@ main(int argc, char **argv)
rname = optarg;
break;
case 's':
- if (expand_number(optarg, &sz) == -1)
+ do_relative = *optarg == '+' || *optarg == '-';
+ if (expand_number(do_relative ? optarg + 1 : optarg,
+ &usz) == -1 || (off_t)usz < 0)
errx(EXIT_FAILURE,
"invalid size argument `%s'", optarg);
- if (*optarg == '+' || *optarg == '-')
- do_relative = 1;
+
+ sz = (*optarg == '-') ? -(off_t)usz : (off_t)usz;
got_size = 1;
break;
default:
diff --git a/usr.bin/truss/Makefile.depend.amd64 b/usr.bin/truss/Makefile.depend.amd64
index 844c881..138628c 100644
--- a/usr.bin/truss/Makefile.depend.amd64
+++ b/usr.bin/truss/Makefile.depend.amd64
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h
index c60c6c7..820f4f0 100644
--- a/usr.bin/truss/extern.h
+++ b/usr.bin/truss/extern.h
@@ -55,10 +55,6 @@ extern long i386_syscall_exit(struct trussinfo *, int);
extern void i386_linux_syscall_entry(struct trussinfo *, int);
extern long i386_linux_syscall_exit(struct trussinfo *, int);
#endif
-#ifdef __ia64__
-extern void ia64_syscall_entry(struct trussinfo *, int);
-extern long ia64_syscall_exit(struct trussinfo *, int);
-#endif
#ifdef __powerpc__
extern void powerpc_syscall_entry(struct trussinfo *, int);
extern long powerpc_syscall_exit(struct trussinfo *, int);
diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c
deleted file mode 100644
index 2218fe5..0000000
--- a/usr.bin/truss/ia64-fbsd.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright 1997 Sean Eric Fagan
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Sean Eric Fagan
- * 4. Neither the name of the author may be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * FreeBSD/ia64-specific system call handling. This is probably the most
- * complex part of the entire truss program, although I've got lots of
- * it handled relatively cleanly now. The system call names are generated
- * automatically, thanks to /usr/src/sys/kern/syscalls.master. The
- * names used for the various structures are confusing, I sadly admit.
- */
-
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/syscall.h>
-
-#include <machine/reg.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "truss.h"
-#include "syscall.h"
-#include "extern.h"
-
-#include "syscalls.h"
-
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
-
-/*
- * This is what this particular file uses to keep track of a system call.
- * It is probably not quite sufficient -- I can probably use the same
- * structure for the various syscall personalities, and I also probably
- * need to nest system calls (for signal handlers).
- *
- * 'struct syscall' describes the system call; it may be NULL, however,
- * if we don't know about this particular system call yet.
- */
-struct freebsd_syscall {
- struct syscall *sc;
- const char *name;
- int number;
- unsigned long *args;
- int nargs; /* number of arguments -- *not* number of words! */
- char **s_args; /* the printable arguments */
-};
-
-static struct freebsd_syscall *
-alloc_fsc(void)
-{
-
- return (malloc(sizeof(struct freebsd_syscall)));
-}
-
-/* Clear up and free parts of the fsc structure. */
-static void
-free_fsc(struct freebsd_syscall *fsc)
-{
- int i;
-
- free(fsc->args);
- if (fsc->s_args) {
- for (i = 0; i < fsc->nargs; i++)
- free(fsc->s_args[i]);
- free(fsc->s_args);
- }
- free(fsc);
-}
-
-/*
- * Called when a process has entered a system call. nargs is the
- * number of words, not number of arguments (a necessary distinction
- * in some cases). Note that if the STOPEVENT() code in ia64/ia64/trap.c
- * is ever changed these functions need to keep up.
- */
-
-void
-ia64_syscall_entry(struct trussinfo *trussinfo, int nargs)
-{
- struct reg regs;
- struct freebsd_syscall *fsc;
- struct syscall *sc;
- unsigned long *parm_offset;
- lwpid_t tid;
- int i, syscall_num;
-
- tid = trussinfo->curthread->tid;
-
- if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
- parm_offset = &regs.r_scratch.gr16;
-
- /*
- * FreeBSD has two special kinds of system call redirctions --
- * SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basically; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_scratch.gr15; /* XXX double-check. */
- if (syscall_num == SYS_syscall || syscall_num == SYS___syscall)
- syscall_num = (int)*parm_offset++;
-
- fsc = alloc_fsc();
- if (fsc == NULL)
- return;
- fsc->number = syscall_num;
- fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ?
- NULL : syscallnames[syscall_num];
- if (!fsc->name) {
- fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n",
- syscall_num);
- }
-
- if (fsc->name && (trussinfo->flags & FOLLOWFORKS) &&
- (strcmp(fsc->name, "fork") == 0 ||
- strcmp(fsc->name, "rfork") == 0 ||
- strcmp(fsc->name, "vfork") == 0))
- trussinfo->curthread->in_fork = 1;
-
- if (nargs == 0)
- return;
-
- fsc->args = malloc((1 + nargs) * sizeof(unsigned long));
- memcpy(fsc->args, parm_offset, nargs * sizeof(long));
-
- sc = get_syscall(fsc->name);
- if (sc)
- fsc->nargs = sc->nargs;
- else {
-#if DEBUG
- fprintf(trussinfo->outfile, "unknown syscall %s -- setting "
- "args to %d\n", fsc->name, nargs);
-#endif
- fsc->nargs = nargs;
- }
-
- fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *));
- fsc->sc = sc;
-
- /*
- * At this point, we set up the system call arguments.
- * We ignore any OUT ones, however -- those are arguments that
- * are set by the system call, and so are probably meaningless
- * now. This doesn't currently support arguments that are
- * passed in *and* out, however.
- */
-
- if (fsc->name) {
-#if DEBUG
- fprintf(stderr, "syscall %s(", fsc->name);
-#endif
- for (i = 0; i < fsc->nargs; i++) {
-#if DEBUG
- fprintf(stderr, "0x%x%s", sc ?
- fsc->args[sc->args[i].offset] : fsc->args[i],
- i < (fsc->nargs - 1) ? "," : "");
-#endif
- if (sc && !(sc->args[i].type & OUT)) {
- fsc->s_args[i] = print_arg(&sc->args[i],
- fsc->args, 0, trussinfo);
- }
- }
-#if DEBUG
- fprintf(stderr, ")\n");
-#endif
- }
-
-#if DEBUG
- fprintf(trussinfo->outfile, "\n");
-#endif
-
- if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
- strcmp(fsc->name, "exit") == 0)) {
- /*
- * XXX
- * This could be done in a more general
- * manner but it still wouldn't be very pretty.
- */
- if (strcmp(fsc->name, "execve") == 0) {
- if ((trussinfo->flags & EXECVEARGS) == 0) {
- if (fsc->s_args[1]) {
- free(fsc->s_args[1]);
- fsc->s_args[1] = NULL;
- }
- }
- if ((trussinfo->flags & EXECVEENVS) == 0) {
- if (fsc->s_args[2]) {
- free(fsc->s_args[2]);
- fsc->s_args[2] = NULL;
- }
- }
- }
- }
- trussinfo->curthread->fsc = fsc;
-}
-
-/*
- * And when the system call is done, we handle it here.
- * Currently, no attempt is made to ensure that the system calls
- * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the system call number instead of, say, an error status).
- */
-
-long
-ia64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
-{
- struct reg regs;
- struct freebsd_syscall *fsc;
- struct syscall *sc;
- lwpid_t tid;
- long retval;
- int errorp, i;
-
- if (trussinfo->curthread->fsc == NULL)
- return (-1);
-
- tid = trussinfo->curthread->tid;
-
- if (ptrace(PT_GETREGS, tid, (caddr_t)&regs, 0) < 0) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
-
- retval = regs.r_scratch.gr8;
- errorp = (regs.r_scratch.gr10 != 0) ? 1 : 0;
-
- /*
- * This code, while simpler than the initial versions I used, could
- * stand some significant cleaning.
- */
-
- fsc = trussinfo->curthread->fsc;
- sc = fsc->sc;
- if (!sc) {
- for (i = 0; i < fsc->nargs; i++)
- asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]);
- } else {
- /*
- * Here, we only look for arguments that have OUT masked in --
- * otherwise, they were handled in the syscall_entry function.
- */
- for (i = 0; i < sc->nargs; i++) {
- char *temp;
- if (sc->args[i].type & OUT) {
- /*
- * If an error occurred, then don't bother
- * getting the data; it may not be valid.
- */
- if (errorp) {
- asprintf(&temp, "0x%lx",
- fsc->args[sc->args[i].offset]);
- } else {
- temp = print_arg(&sc->args[i],
- fsc->args, retval, trussinfo);
- }
- fsc->s_args[i] = temp;
- }
- }
- }
-
- if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 ||
- strcmp(fsc->name, "exit") == 0))
- trussinfo->curthread->in_syscall = 1;
-
- /*
- * It would probably be a good idea to merge the error handling,
- * but that complicates things considerably.
- */
-
- print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp,
- retval, fsc->sc);
- free_fsc(fsc);
-
- return (retval);
-}
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index ecaa0db..7792caf 100644
--- a/usr.bin/truss/main.c
+++ b/usr.bin/truss/main.c
@@ -93,9 +93,6 @@ static struct ex_types {
{ "FreeBSD ELF32", i386_syscall_entry, i386_syscall_exit },
{ "Linux ELF", i386_linux_syscall_entry, i386_linux_syscall_exit },
#endif
-#ifdef __ia64__
- { "FreeBSD ELF64", ia64_syscall_entry, ia64_syscall_exit },
-#endif
#ifdef __powerpc__
{ "FreeBSD ELF", powerpc_syscall_entry, powerpc_syscall_exit },
{ "FreeBSD ELF32", powerpc_syscall_entry, powerpc_syscall_exit },
diff --git a/usr.bin/tset/Makefile b/usr.bin/tset/Makefile
index 126cf321..c486bf8 100644
--- a/usr.bin/tset/Makefile
+++ b/usr.bin/tset/Makefile
@@ -1,10 +1,11 @@
# @(#)Makefile 8.1 (Berkeley) 6/9/93
+# $FreeBSD$
PROG= tset
SRCS= map.c misc.c set.c term.c tset.c wrterm.c
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
LINKS= ${BINDIR}/tset ${BINDIR}/reset
MLINKS= tset.1 reset.1
diff --git a/usr.bin/tset/Makefile.depend b/usr.bin/tset/Makefile.depend
index 4f4df65..a25f5f6 100644
--- a/usr.bin/tset/Makefile.depend
+++ b/usr.bin/tset/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/ul/Makefile b/usr.bin/ul/Makefile
index 9aaf775..685e4a4 100644
--- a/usr.bin/ul/Makefile
+++ b/usr.bin/ul/Makefile
@@ -3,7 +3,7 @@
PROG= ul
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
+DPADD= ${LIBTERMCAPW}
+LDADD= -ltermcapw
.include <bsd.prog.mk>
diff --git a/usr.bin/ul/Makefile.depend b/usr.bin/ul/Makefile.depend
index 4f4df65..a25f5f6 100644
--- a/usr.bin/ul/Makefile.depend
+++ b/usr.bin/ul/Makefile.depend
@@ -10,7 +10,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/ncurses/ncurses \
lib/ncurses/ncursesw \
diff --git a/usr.bin/unifdef/unifdef.1 b/usr.bin/unifdef/unifdef.1
index d362eaf..f09a244 100644
--- a/usr.bin/unifdef/unifdef.1
+++ b/usr.bin/unifdef/unifdef.1
@@ -415,9 +415,10 @@ command appeared in
support was added in
.Fx 4.7 .
.Sh AUTHORS
+.An -nosplit
The original implementation was written by
-.An Dave Yost Aq Dave@Yost.com .
-.An Tony Finch Aq dot@dotat.at
+.An Dave Yost Aq Mt Dave@Yost.com .
+.An Tony Finch Aq Mt dot@dotat.at
rewrote it to support
.Tn ANSI\~C .
.Sh BUGS
diff --git a/usr.bin/units/Makefile b/usr.bin/units/Makefile
index ebd1e07..3757c85 100644
--- a/usr.bin/units/Makefile
+++ b/usr.bin/units/Makefile
@@ -1,10 +1,16 @@
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= units
FILES= units.lib
FILESDIR= ${SHAREDIR}/misc
-LDADD+=-ledit -ltermcap
-DPADD+=${LIBEDIT} ${LIBTERMCAP}
+LDADD+=-ledit -ltermcapw
+DPADD+=${LIBEDIT} ${LIBTERMCAPW}
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
.include <bsd.prog.mk>
diff --git a/usr.bin/units/Makefile.depend b/usr.bin/units/Makefile.depend
index 6fc94a4..1ba7586 100644
--- a/usr.bin/units/Makefile.depend
+++ b/usr.bin/units/Makefile.depend
@@ -11,7 +11,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libedit \
- lib/ncurses/ncurses \
+ lib/ncurses/ncursesw \
.include <dirdeps.mk>
diff --git a/usr.bin/units/tests/Makefile b/usr.bin/units/tests/Makefile
new file mode 100644
index 0000000..0694eff
--- /dev/null
+++ b/usr.bin/units/tests/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/usr.bin/units
+
+TAP_TESTS_SH= basics_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/units/tests/basics_test.sh b/usr.bin/units/tests/basics_test.sh
new file mode 100644
index 0000000..adc28e0
--- /dev/null
+++ b/usr.bin/units/tests/basics_test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# $FreeBSD$
+
+base=`basename $0`
+
+echo "1..3"
+
+assert_equals() {
+ testnum="$1"
+ expected="$2"
+ fn="$3"
+ if [ "$expected" = "$($fn)" ]
+ then
+ echo "ok $testnum - $fn"
+ else
+ echo "not ok $testnum - $fn"
+ fi
+}
+
+assert_equals 1 1 "units -t ft ft"
+assert_equals 2 12 "units -t ft in"
+assert_equals 3 0.083333333 "units -t in ft"
diff --git a/usr.bin/units/units.1 b/usr.bin/units/units.1
index 83f2d9e..751d9ce 100644
--- a/usr.bin/units/units.1
+++ b/usr.bin/units/units.1
@@ -1,5 +1,5 @@
.\" $FreeBSD$
-.Dd April 14, 2014
+.Dd July 4, 2014
.Dt UNITS 1
.Os
.Sh NAME
@@ -13,17 +13,31 @@
.Sh OPTIONS
The following options are available:
.Bl -tag -width indent
-.It Fl f Ar filename
+.It Fl h No , Fl -help
+Show an overview of options
+.It Fl f Ar filename No , Fl -file Ar filename
Specify the name of the units data file to load.
-.It Fl q
+.It Fl e , Fl -exponential
+Behave as if -o '%6e' was typed.
+.It Fl q No , Fl -quiet
Suppress prompting of the user for units and the display of statistics
about the number of units loaded.
-.It Fl U
-If the default unit file exists prints its location. If not, print
+.It Fl U No , Fl -unitsfile
+If the default unit file exists prints its location.
+If not, print
.Qo
Units data file not found
.Qc
-.It Fl V
+.It Fl t No , Fl -terse
+Only print the result. This is used when calling
+.Nm
+from other programs for easy to parse results.
+.It Fl v No , Fl -verbose
+Print the units in the conversion output.
+Be more verbose in general.
+.It Fl o Ar format No , Fl -output-format Ar format
+Select the output format string by which numbers are printed.
+.It Fl V No , Fl -version
Print the version number, usage, and then exit.
.It Ar from-unit to-unit
Allow a single unit conversion to be done directly from the command
@@ -31,8 +45,6 @@ line.
The program will not print prompts.
It will print out the
result of the single specified conversion.
-.It Fl v
-Print the units in the conversion output. Be more verbose in general.
.El
.Sh DESCRIPTION
The
@@ -141,7 +153,7 @@ The
program will not detect infinite loops that could be caused
by careless unit definitions.
Comments in the unit definition file
-begin with a '/' character at the beginning of a line.
+begin with a '#' or '/' character at the beginning of a line.
.Pp
Prefixes are defined in the same was as standard units, but with
a trailing dash at the end of the prefix name.
@@ -170,7 +182,7 @@ units.
the standard units library
.El
.Sh AUTHORS
-.An Adrian Mariano Aq adrian@cam.cornell.edu
+.An Adrian Mariano Aq Mt adrian@cam.cornell.edu
.Sh BUGS
The effect of including a '/' in a prefix is surprising.
.Pp
diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c
index 70bd9ec..3d39d0e 100644
--- a/usr.bin/units/units.c
+++ b/usr.bin/units/units.c
@@ -24,6 +24,7 @@ static const char rcsid[] =
#include <err.h>
#include <errno.h>
#include <histedit.h>
+#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -68,19 +69,16 @@ static struct {
static char NULLUNIT[] = "";
-#ifdef MSDOS
-#define SEPARATOR ";"
-#else
#define SEPARATOR ":"
-#endif
static int unitcount;
static int prefixcount;
static bool verbose = false;
+static bool terse = false;
+static const char * outputformat;
static const char * havestr;
static const char * wantstr;
-
static int addsubunit(char *product[], char *toadd);
static int addunit(struct unittype *theunit, const char *toadd, int flip, int quantity);
static void cancelunit(struct unittype * theunit);
@@ -106,20 +104,19 @@ static const char * prompt(EditLine *e __unused) {
return promptstr;
}
-char *
+static char *
dupstr(const char *str)
{
char *ret;
- ret = malloc(strlen(str) + 1);
+ ret = strdup(str);
if (!ret)
- errx(3, "memory allocation error");
- strcpy(ret, str);
+ err(3, "dupstr");
return (ret);
}
-void
+static void
readunits(const char *userfile)
{
FILE *unitfile;
@@ -166,7 +163,7 @@ readunits(const char *userfile)
break;
linenum++;
lineptr = line;
- if (*lineptr == '/')
+ if (*lineptr == '/' || *lineptr == '#')
continue;
lineptr += strspn(lineptr, " \n\t");
len = strcspn(lineptr, " \n\t");
@@ -224,7 +221,7 @@ readunits(const char *userfile)
fclose(unitfile);
}
-void
+static void
initializeunit(struct unittype * theunit)
{
theunit->numerator[0] = theunit->denominator[0] = NULL;
@@ -234,7 +231,7 @@ initializeunit(struct unittype * theunit)
}
-int
+static int
addsubunit(char *product[], char *toadd)
{
char **ptr;
@@ -251,7 +248,7 @@ addsubunit(char *product[], char *toadd)
}
-void
+static void
showunit(struct unittype * theunit)
{
char **ptr;
@@ -293,7 +290,7 @@ showunit(struct unittype * theunit)
counter = 1;
}
}
- if ( counter > 1)
+ if (counter > 1)
printf("%s%d", powerstring, counter);
printf("\n");
}
@@ -313,7 +310,7 @@ zeroerror(void)
Returns 0 for successful addition, nonzero on error.
*/
-int
+static int
addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
{
char *scratch, *savescr;
@@ -421,14 +418,14 @@ addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
}
-int
+static int
compare(const void *item1, const void *item2)
{
return strcmp(*(const char * const *)item1, *(const char * const *)item2);
}
-void
+static void
sortunit(struct unittype * theunit)
{
char **ptr;
@@ -549,7 +546,7 @@ lookupunit(const char *unit)
#define ERROR 4
-int
+static int
reduceproduct(struct unittype * theunit, int flip)
{
@@ -592,7 +589,7 @@ reduceproduct(struct unittype * theunit, int flip)
Returns 0 on success, or 1 on unknown unit error.
*/
-int
+static int
reduceunit(struct unittype * theunit)
{
int ret;
@@ -607,7 +604,7 @@ reduceunit(struct unittype * theunit)
}
-int
+static int
compareproducts(char **one, char **two)
{
while (*one || *two) {
@@ -630,7 +627,7 @@ compareproducts(char **one, char **two)
/* Return zero if units are compatible, nonzero otherwise */
-int
+static int
compareunits(struct unittype * first, struct unittype * second)
{
return
@@ -639,7 +636,7 @@ compareunits(struct unittype * first, struct unittype * second)
}
-int
+static int
completereduce(struct unittype * unit)
{
if (reduceunit(unit))
@@ -649,32 +646,40 @@ completereduce(struct unittype * unit)
return 0;
}
-void
+static void
showanswer(struct unittype * have, struct unittype * want)
{
double ans;
+ char* oformat;
if (compareunits(have, want)) {
printf("conformability error\n");
if (verbose)
printf("\t%s = ", havestr);
- else
+ else if (!terse)
printf("\t");
showunit(have);
- if (verbose)
- printf("\t%s = ", wantstr);
- else
- printf("\t");
- showunit(want);
+ if (!terse) {
+ if (verbose)
+ printf("\t%s = ", wantstr);
+ else
+ printf("\t");
+ showunit(want);
+ }
}
else if (have->offset != want->offset) {
if (want->quantity)
printf("WARNING: conversion of non-proportional quantities.\n");
- if (have->quantity)
- printf("\t%.8g\n",
+ if (have->quantity) {
+ asprintf(&oformat, "\t%s\n", outputformat);
+ printf(oformat,
(have->factor + have->offset-want->offset)/want->factor);
+ free(oformat);
+ }
else {
- printf("\t (-> x*%.8g %+.8g)\n\t (<- y*%.8g %+.8g)\n",
+ asprintf(&oformat, "\t (-> x*%sg %sg)\n\t (<- y*%sg %sg)\n",
+ outputformat, outputformat, outputformat, outputformat);
+ printf(oformat,
have->factor / want->factor,
(have->offset-want->offset)/want->factor,
want->factor / have->factor,
@@ -683,20 +688,38 @@ showanswer(struct unittype * have, struct unittype * want)
}
else {
ans = have->factor / want->factor;
- if (verbose)
- printf("\t%s = %.8g * %s\n", havestr, ans, wantstr);
- else
- printf("\t* %.8g\n", ans);
- if (verbose)
- printf("\t%s = (1 / %.8g) * %s\n", havestr, 1/ans, wantstr);
- else
- printf("\t/ %.8g\n", 1/ans);
+ if (verbose) {
+ printf("\t%s = ", havestr);
+ printf(outputformat, ans);
+ printf(" * %s", wantstr);
+ printf("\n");
+ }
+ else if (terse) {
+ printf(outputformat, ans);
+ printf("\n");
+ }
+ else {
+ printf("\t* ");
+ printf(outputformat, ans);
+ printf("\n");
+ }
+
+ if (verbose) {
+ printf("\t%s = (1 / ", havestr);
+ printf(outputformat, 1/ans);
+ printf(") * %s\n", wantstr);
+ }
+ else if (!terse) {
+ printf("\t/ ");
+ printf(outputformat, 1/ans);
+ printf("\n");
+ }
}
}
-void
+static void
usage(void)
{
fprintf(stderr,
@@ -704,6 +727,19 @@ usage(void)
exit(3);
}
+static struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"exponential", no_argument, NULL, 'e'},
+ {"file", required_argument, NULL, 'f'},
+ {"output-format", required_argument, NULL, 'o'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"terse", no_argument, NULL, 't'},
+ {"unitsfile", no_argument, NULL, 'U'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"version", no_argument, NULL, 'V'},
+ { 0, 0, 0, 0 }
+};
+
int
main(int argc, char **argv)
@@ -720,8 +756,12 @@ main(int argc, char **argv)
quiet = false;
readfile = false;
- while ((optchar = getopt(argc, argv, "fqvUV:")) != -1) {
+ outputformat = "%.8g";
+ while ((optchar = getopt_long(argc, argv, "+ehf:oqtvUV", longopts, NULL)) != -1) {
switch (optchar) {
+ case 'e':
+ outputformat = "%6e";
+ break;
case 'f':
readfile = true;
if (strlen(optarg) == 0)
@@ -732,9 +772,18 @@ main(int argc, char **argv)
case 'q':
quiet = true;
break;
+ case 't':
+ terse = true;
+ break;
+ case 'o':
+ outputformat = optarg;
+ break;
case 'v':
verbose = true;
break;
+ case 'V':
+ fprintf(stderr, "FreeBSD units\n");
+ /* FALLTHROUGH */
case 'U':
if (access(UNITSFILE, F_OK) == 0)
printf("%s\n", UNITSFILE);
@@ -742,10 +791,9 @@ main(int argc, char **argv)
printf("Units data file not found");
exit(0);
break;
- case 'V':
- fprintf(stderr, "FreeBSD units\n");
- usage();
- break;
+ case 'h':
+ /* FALLTHROUGH */
+
default:
usage();
}
@@ -763,7 +811,7 @@ main(int argc, char **argv)
el_source(el, NULL);
history(inhistory, &ev, H_SETSIZE, 800);
if (inhistory == 0)
- err(1, "Could not initalize history");
+ err(1, "Could not initialize history");
if (cap_enter() < 0 && errno != ENOSYS)
err(1, "unable to enter capability mode");
@@ -813,5 +861,6 @@ main(int argc, char **argv)
}
history_end(inhistory);
- return(0);
+ el_end(el);
+ return (0);
}
diff --git a/usr.bin/units/units.lib b/usr.bin/units/units.lib
index 4c48322..3efafd8 100644
--- a/usr.bin/units/units.lib
+++ b/usr.bin/units/units.lib
@@ -1,6 +1,6 @@
-/ $FreeBSD$
+# $FreeBSD$
-/ primitive units
+# primitive units
m !a!
kg !b!
@@ -13,7 +13,7 @@ bit !h!
erlang !i!
K !j!
-/ prefixes
+# prefixes
yotta- 1e24
zetta- 1e21
@@ -68,7 +68,7 @@ a- atto
z- zopto
y- yocto
-/ binary prefixes introduced in 1999
+# binary prefixes introduced in 1999
exbi- 1152921504606846976
pebi- 1125899906842624
tebi- 1099511627776
@@ -83,7 +83,7 @@ Gi- gibi
Mi- mebi
Ki- kibi
-/ constants
+# constants
fuzz 1
pi 3.14159265358979323846
@@ -109,7 +109,7 @@ electronmass 9.1093821545-31 kg
protonmass 1.6726217129-27 kg
neutronmass 1.6749272928-27 kg
-/ dimensionless
+# dimensionless
radian .5 / pi
degree 1|180 pi-radian
@@ -127,7 +127,7 @@ steradian radian2
sphere 4 pi-steradian
sr steradian
-/ Time
+# Time
second sec
s sec
@@ -143,13 +143,13 @@ yr year
month 1|12 year
us microsec
-/ Mass
+# Mass
gram millikg
gm gram
metricton kilokg
-/ Avoirdupois
+# Avoirdupois
lb .45359237 kg
pound lb
@@ -164,7 +164,7 @@ shortton 2000 lb
ton shortton
longton 2240 lb
-/ Apothecary
+# Apothecary
scruple 20 grain
apdram 60 grain
@@ -172,7 +172,7 @@ apounce 480 grain
appound 5760 grain
troypound appound
-/ Mining
+# Mining
troyounce apounce
troz apounce
@@ -180,7 +180,7 @@ pennyweight 1|20 troz
pwt pennyweight
dwt pennyweight
-/ Length
+# Length
meter m
micron micrometer
@@ -208,7 +208,7 @@ cc cm3
liter kilocc
ml milliliter
-/ US Liquid
+# US Liquid
gallon 231 in3
imperial 1.20095
@@ -222,7 +222,7 @@ floz 1|16 pt
fldr 1|8 floz
shot 3|2 floz
-/ US Dry
+# US Dry
dry 268.8025 in3/gallon fuzz
peck 8 dry-quart
@@ -231,7 +231,7 @@ bushel 4 peck
bu bushel
chaldron 36 bushel
-/ British
+# British
brgallon 277.420 in3 fuzz
brquart 1|4 brgallon
@@ -241,10 +241,10 @@ brpeck 554.84 in3 fuzz
brbushel 4 brpeck
brhundredweight 112 lb
-/ Bottles
+# Bottles
bottle 750 milliliter
-/bottle fifth
+#bottle fifth
miniature 100 milliliter
split 1|4 bottle
@@ -258,7 +258,7 @@ balthazar 16 bottle
nebuchadnezzar 20 bottle
sovereign 34 bottle
-/ Bottles - alternate names and spellings
+# Bottles - alternate names and spellings
pony split
fillette half
@@ -266,7 +266,7 @@ tappit-hen 3 imperial
rheoboam rehoboam
shalmaneser salmanazar
-/ Russian
+# Russian
berkovets 10 pood
pood 40 funt
funt 0.40951 kg
@@ -279,7 +279,7 @@ verst 1066.8 m
sazhen 1|500 verst
kosayasazhen 1|430.2 verst
arshin 1|1500 verst
-/ is not exactly defined
+# is not exactly defined
ruell 16.54 in
liniya 1|10 in
vershok 1.75 in
@@ -296,7 +296,7 @@ sqverst 104.2 desyatina_state
sqarshin 1|21600 desyatina_state
sqfoot 1|117600 desyatina_state
-/ Energy Work
+# Energy Work
newton kg-m/sec2
nt newton
@@ -306,7 +306,7 @@ J joule
cal 4.1868 joule
ergon erg
-/ Electrical
+# Electrical
coulomb coul
C coul
@@ -325,14 +325,14 @@ H henry
weber volt-sec
Wb weber
-/ Light
+# Light
cd candela
lumen cd sr
lux cd sr/m2
-/ EMU currencies have constant exchange rate against Euro since 1.1.1999.
-/ See http://en.wikipedia.org/wiki/Euro for details.
+# EMU currencies have constant exchange rate against Euro since 1.1.1999.
+# See http://en.wikipedia.org/wiki/Euro for details.
austriaschilling 1|13.7603 euro
belgiumfranc 1|40.3399 euro
finlandmarkka 1|5.94573 euro
@@ -350,8 +350,8 @@ cypriotpound 1|0.585274 euro
malteselira 1|0.429300 euro
slovakkoruna 1|30.1260 euro
-/ These ones are pegged to the Euro
-/ See http://en.wikipedia.org/wiki/Euro for details.
+# These ones are pegged to the Euro
+# See http://en.wikipedia.org/wiki/Euro for details.
bosniaherzegovinamark 1|1.95583 euro
bulgarianlev 1|1.95583 euro
capeverdeanescudo 1|110.265 euro
@@ -363,8 +363,8 @@ lithuanianlitas 1|3.45280 euro
pacificfrancexchange 1|0.00838 euro
westafricancfafranc 1|655.957 euro
-/ These ones are pegged on the US Dollar
-/ See http://en.wikipedia.org/wiki/USD for details.
+# These ones are pegged on the US Dollar
+# See http://en.wikipedia.org/wiki/USD for details.
dollar usdollar
arubanflorin 1|1.75 usdollar
bahamiandollar 1|1 usdollar
@@ -404,7 +404,7 @@ markka finlandmarkka
peseta spainpeseta
rand southafricarand
-/ computer
+# computer
baud bit/sec
nibble 4 bit
@@ -424,7 +424,7 @@ kilobyte kbyte
meg megabyte
-/ Trivia
+# Trivia
% 1|100
abampere 10 ampere
diff --git a/usr.bin/unzip/unzip.1 b/usr.bin/unzip/unzip.1
index 0c54051..fd9b10f 100644
--- a/usr.bin/unzip/unzip.1
+++ b/usr.bin/unzip/unzip.1
@@ -182,8 +182,8 @@ utility appeared in
The
.Nm
utility and this manual page were written by
-.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
It uses the
.Xr archive 3
library developed by
-.An Tim Kientzle Aq kientzle@FreeBSD.org .
+.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
diff --git a/usr.bin/users/Makefile b/usr.bin/users/Makefile
index 3d6524b..dd04a11 100644
--- a/usr.bin/users/Makefile
+++ b/usr.bin/users/Makefile
@@ -1,6 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
-PROG= users
+WARNS= 3
+PROG_CXX= users
+CXXFLAGS+= -fno-rtti
.include <bsd.prog.mk>
diff --git a/usr.bin/users/Makefile.depend b/usr.bin/users/Makefile.depend
index 96aa2a2..3ec7ff9 100644
--- a/usr.bin/users/Makefile.depend
+++ b/usr.bin/users/Makefile.depend
@@ -9,7 +9,10 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
+ lib/libc++ \
lib/libcompiler_rt \
+ lib/libcxxrt \
+ lib/msun \
.include <dirdeps.mk>
diff --git a/usr.bin/users/users.c b/usr.bin/users/users.c
deleted file mode 100644
index c13cc37..0000000
--- a/usr.bin/users/users.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 1980, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1980, 1987, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)users.c 8.1 (Berkeley) 6/6/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <utmpx.h>
-
-typedef char namebuf[sizeof(((struct utmpx *)0)->ut_user) + 1];
-
-int scmp(const void *, const void *);
-static void usage(void);
-
-int
-main(int argc, char **argv)
-{
- namebuf *names = NULL;
- int ncnt = 0;
- int nmax = 0;
- int cnt;
- struct utmpx *ut;
- int ch;
-
- while ((ch = getopt(argc, argv, "")) != -1)
- switch(ch) {
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- setutxent();
- while ((ut = getutxent()) != NULL) {
- if (ut->ut_type != USER_PROCESS)
- continue;
- if (ncnt >= nmax) {
- nmax += 32;
- names = realloc(names, sizeof(*names) * nmax);
- if (!names) {
- errx(1, "realloc");
- /* NOTREACHED */
- }
- }
- (void)strlcpy(names[ncnt], ut->ut_user, sizeof(*names));
- ++ncnt;
- }
- endutxent();
- if (ncnt > 0) {
- qsort(names, ncnt, sizeof(namebuf), scmp);
- (void)printf("%s", names[0]);
- for (cnt = 1; cnt < ncnt; ++cnt)
- if (strcmp(names[cnt], names[cnt - 1]) != 0)
- (void)printf(" %s", names[cnt]);
- (void)printf("\n");
- }
- exit(0);
-}
-
-static void
-usage(void)
-{
- (void)fprintf(stderr, "usage: users\n");
- exit(1);
-}
-
-int
-scmp(const void *p, const void *q)
-{
-
- return (strcmp(p, q));
-}
diff --git a/usr.bin/gprof/ia64.h b/usr.bin/users/users.cc
index 58b92c5..914888d 100644
--- a/usr.bin/gprof/ia64.h
+++ b/usr.bin/users/users.cc
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2014 Pietro Cerutti <gahr@FreeBSD.org>
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,16 +25,41 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * @(#)i386.h 8.1 (Berkeley) 6/6/93
- * $FreeBSD$
*/
- /*
- * offset (in bytes) of the code from the entry address of a routine.
- * (see asgnsamples for use and explanation.)
- */
-#define OFFSET_OF_CODE 0
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <utmpx.h>
+
+#include <algorithm>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <string>
+using namespace std;
+
+int
+main(int argc, char **)
+{
+ struct utmpx *ut;
+ set<string> names;
+
+ if (argc > 1) {
+ cerr << "usage: users" << endl;
+ return (1);
+ }
+
+ setutxent();
+ while ((ut = getutxent()) != NULL)
+ if (ut->ut_type == USER_PROCESS)
+ names.insert(ut->ut_user);
+ endutxent();
-enum opermodes { dummy };
-typedef enum opermodes operandenum;
+ if (!names.empty()) {
+ set<string>::iterator last = names.end();
+ --last;
+ copy(names.begin(), last, ostream_iterator<string>(cout, " "));
+ cout << *last << endl;
+ }
+}
diff --git a/usr.bin/vacation/Makefile b/usr.bin/vacation/Makefile
index 056f576..4f8690c 100644
--- a/usr.bin/vacation/Makefile
+++ b/usr.bin/vacation/Makefile
@@ -32,6 +32,8 @@ DPADD+=${SENDMAIL_DPADD}
LDADD+=${SENDMAIL_LDADD}
LDFLAGS+=${SENDMAIL_LDFLAGS}
+NO_PIE= yes
+
sm_os.h:
ln -sf ${SENDMAIL_DIR}/include/sm/os/sm_os_freebsd.h sm_os.h
diff --git a/usr.bin/vi/Makefile b/usr.bin/vi/Makefile
index 16675c9..6ed95ee 100644
--- a/usr.bin/vi/Makefile
+++ b/usr.bin/vi/Makefile
@@ -36,14 +36,9 @@ CFLAGS+=-I${.CURDIR} -I${SRCDIR} -I${SRCDIR}/regex
DPADD= ${LIBUTIL}
LDADD= -lutil
-.if defined(RESCUE) || defined(RELEASE_CRUNCH) || ${MK_NCURSESW} == "no"
-DPADD+= ${LIBNCURSES}
-LDADD+= -lncurses
-.else
CFLAGS+= -DUSE_WIDECHAR
DPADD+= ${LIBNCURSESW}
LDADD+= -lncursesw
-.endif
.if ${MK_ICONV} == "yes" && !defined(RESCUE) && !defined(RELEASE_CRUNCH)
CFLAGS+= -DUSE_ICONV
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index c089dbf..67f438e 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -80,7 +80,7 @@ static char da[] = "da";
static struct nlist namelist[] = {
#define X_SUM 0
- { "_cnt" },
+ { "_vm_cnt" },
#define X_HZ 1
{ "_hz" },
#define X_STATHZ 2
@@ -259,8 +259,18 @@ main(int argc, char *argv[])
errx(1, "kvm_openfiles: %s", errbuf);
}
+retry_nlist:
if (kd != NULL && (c = kvm_nlist(kd, namelist)) != 0) {
if (c > 0) {
+ /*
+ * 'cnt' was renamed to 'vm_cnt'. If 'vm_cnt' is not
+ * found try looking up older 'cnt' symbol.
+ * */
+ if (namelist[X_SUM].n_type == 0 &&
+ strcmp(namelist[X_SUM].n_name, "_vm_cnt") == 0) {
+ namelist[X_SUM].n_name = "_cnt";
+ goto retry_nlist;
+ }
warnx("undefined symbols:");
for (c = 0;
c < (int)(sizeof(namelist)/sizeof(namelist[0]));
diff --git a/usr.bin/vtfontcvt/Makefile b/usr.bin/vtfontcvt/Makefile
new file mode 100644
index 0000000..a9802f7
--- /dev/null
+++ b/usr.bin/vtfontcvt/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= vtfontcvt
+MAN8= vtfontcvt.8
+
+WARNS?= 6
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/vtfontcvt/Makefile.depend b/usr.bin/vtfontcvt/Makefile.depend
new file mode 100644
index 0000000..96aa2a2
--- /dev/null
+++ b/usr.bin/vtfontcvt/Makefile.depend
@@ -0,0 +1,19 @@
+# Autogenerated - do NOT edit!
+
+DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vtfontcvt/vtfontcvt.8 b/usr.bin/vtfontcvt/vtfontcvt.8
new file mode 100644
index 0000000..5a9d9b9
--- /dev/null
+++ b/usr.bin/vtfontcvt/vtfontcvt.8
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2014 The FreeBSD Foundation. All rights reserved.
+.\"
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 9, 2014
+.Dt VTFONTCVT 8
+.Os
+.Sh NAME
+.Nm vtfontcvt
+.Nd "convert font files for use by the video console"
+.Sh SYNOPSIS
+.Nm
+.Op Fl h Ar height
+.Op Fl v
+.Op Fl w Ar width
+.Ar normal_font
+.Op Ar bold_font
+.Ar output_file
+.Sh DESCRIPTION
+The
+.Nm
+utility reads source font files in either BDF or Unifont HEX format and
+outputs a binary font file for use by
+.Xr vt 4 .
+HEX format files must have the file extension
+.Pa .hex .
+.Pp
+The following options are available:
+.Bl -tag -width "12345678"
+.It Fl h Ar height
+Set font height.
+The default is 16.
+Font height is set automatically for HEX files that have a
+.Ql # Height: Ar height
+comment before any font data.
+.It Fl v
+Display verbose statistics about the converted font.
+.It Fl w Ar width
+Set font width.
+The default is 8.
+Font width is set automatically for HEX files that have a
+.Ql # Width: Ar width
+comment before any font data.
+.El
+.Sh SEE ALSO
+.Xr vidcontrol 1 ,
+.Xr vt 4
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 10.1 .
diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c
new file mode 100644
index 0000000..21c519b
--- /dev/null
+++ b/usr.bin/vtfontcvt/vtfontcvt.c
@@ -0,0 +1,567 @@
+/*-
+ * Copyright (c) 2009, 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Ed Schouten under sponsorship from the
+ * FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/fnv_hash.h>
+#include <sys/endian.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+
+#include <assert.h>
+#include <err.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define VFNT_MAPS 4
+#define VFNT_MAP_NORMAL 0
+#define VFNT_MAP_NORMAL_RH 1
+#define VFNT_MAP_BOLD 2
+#define VFNT_MAP_BOLD_RH 3
+
+static unsigned int width = 8, wbytes, height = 16;
+
+struct glyph {
+ TAILQ_ENTRY(glyph) g_list;
+ SLIST_ENTRY(glyph) g_hash;
+ uint8_t *g_data;
+ unsigned int g_index;
+};
+
+#define FONTCVT_NHASH 4096
+TAILQ_HEAD(glyph_list, glyph);
+static SLIST_HEAD(, glyph) glyph_hash[FONTCVT_NHASH];
+static struct glyph_list glyphs[VFNT_MAPS] = {
+ TAILQ_HEAD_INITIALIZER(glyphs[0]),
+ TAILQ_HEAD_INITIALIZER(glyphs[1]),
+ TAILQ_HEAD_INITIALIZER(glyphs[2]),
+ TAILQ_HEAD_INITIALIZER(glyphs[3]),
+};
+static unsigned int glyph_total, glyph_count[4], glyph_unique, glyph_dupe;
+
+struct mapping {
+ TAILQ_ENTRY(mapping) m_list;
+ unsigned int m_char;
+ unsigned int m_length;
+ struct glyph *m_glyph;
+};
+
+TAILQ_HEAD(mapping_list, mapping);
+static struct mapping_list maps[VFNT_MAPS] = {
+ TAILQ_HEAD_INITIALIZER(maps[0]),
+ TAILQ_HEAD_INITIALIZER(maps[1]),
+ TAILQ_HEAD_INITIALIZER(maps[2]),
+ TAILQ_HEAD_INITIALIZER(maps[3]),
+};
+static unsigned int mapping_total, map_count[4], map_folded_count[4],
+ mapping_unique, mapping_dupe;
+
+static void
+usage(void)
+{
+
+ (void)fprintf(stderr,
+"usage: vtfontcvt [-w width] [-h height] [-v] normal.bdf [bold.bdf] out.fnt\n");
+ exit(1);
+}
+
+static int
+add_mapping(struct glyph *gl, unsigned int c, unsigned int map_idx)
+{
+ struct mapping *mp;
+ struct mapping_list *ml;
+
+ mapping_total++;
+
+ mp = malloc(sizeof *mp);
+ mp->m_char = c;
+ mp->m_glyph = gl;
+ mp->m_length = 0;
+
+ ml = &maps[map_idx];
+ if (TAILQ_LAST(ml, mapping_list) != NULL &&
+ TAILQ_LAST(ml, mapping_list)->m_char >= c)
+ errx(1, "Bad ordering at character %u\n", c);
+ TAILQ_INSERT_TAIL(ml, mp, m_list);
+
+ map_count[map_idx]++;
+ mapping_unique++;
+
+ return (0);
+}
+
+static int
+dedup_mapping(unsigned int map_idx)
+{
+ struct mapping *mp_bold, *mp_normal, *mp_temp;
+ unsigned normal_map_idx = map_idx - VFNT_MAP_BOLD;
+
+ assert(map_idx == VFNT_MAP_BOLD || map_idx == VFNT_MAP_BOLD_RH);
+ mp_normal = TAILQ_FIRST(&maps[normal_map_idx]);
+ TAILQ_FOREACH_SAFE(mp_bold, &maps[map_idx], m_list, mp_temp) {
+ while (mp_normal->m_char < mp_bold->m_char)
+ mp_normal = TAILQ_NEXT(mp_normal, m_list);
+ if (mp_bold->m_char != mp_normal->m_char)
+ errx(1, "Character %u not in normal font!\n",
+ mp_bold->m_char);
+ if (mp_bold->m_glyph != mp_normal->m_glyph)
+ continue;
+
+ /* No mapping is needed if it's equal to the normal mapping. */
+ TAILQ_REMOVE(&maps[map_idx], mp_bold, m_list);
+ free(mp_bold);
+ mapping_dupe++;
+ }
+ return (0);
+}
+
+static struct glyph *
+add_glyph(const uint8_t *bytes, unsigned int map_idx, int fallback)
+{
+ struct glyph *gl;
+ int hash;
+
+ glyph_total++;
+ glyph_count[map_idx]++;
+
+ hash = fnv_32_buf(bytes, wbytes * height, FNV1_32_INIT) % FONTCVT_NHASH;
+ SLIST_FOREACH(gl, &glyph_hash[hash], g_hash) {
+ if (memcmp(gl->g_data, bytes, wbytes * height) == 0) {
+ glyph_dupe++;
+ return (gl);
+ }
+ }
+
+ gl = malloc(sizeof *gl);
+ gl->g_data = malloc(wbytes * height);
+ memcpy(gl->g_data, bytes, wbytes * height);
+ if (fallback)
+ TAILQ_INSERT_HEAD(&glyphs[map_idx], gl, g_list);
+ else
+ TAILQ_INSERT_TAIL(&glyphs[map_idx], gl, g_list);
+ SLIST_INSERT_HEAD(&glyph_hash[hash], gl, g_hash);
+
+ glyph_unique++;
+ return (gl);
+}
+
+static int
+add_char(unsigned curchar, unsigned map_idx, uint8_t *bytes, uint8_t *bytes_r)
+{
+ struct glyph *gl;
+
+ /* Prevent adding two glyphs for 0xFFFD */
+ if (curchar == 0xFFFD) {
+ if (map_idx < VFNT_MAP_BOLD)
+ gl = add_glyph(bytes, 0, 1);
+ } else if (curchar >= 0x20) {
+ gl = add_glyph(bytes, map_idx, 0);
+ if (add_mapping(gl, curchar, map_idx) != 0)
+ return (1);
+ if (bytes_r != NULL) {
+ gl = add_glyph(bytes_r, map_idx + 1, 0);
+ if (add_mapping(gl, curchar,
+ map_idx + 1) != 0)
+ return (1);
+ }
+ }
+ return (0);
+}
+
+
+static int
+parse_bitmap_line(uint8_t *left, uint8_t *right, unsigned int line,
+ unsigned int dwidth)
+{
+ uint8_t *p;
+ unsigned int i, subline;
+
+ if (dwidth != width && dwidth != width * 2)
+ errx(1, "Bitmap with unsupported width %u!\n", dwidth);
+
+ /* Move pixel data right to simplify splitting double characters. */
+ line >>= (howmany(dwidth, 8) * 8) - dwidth;
+
+ for (i = dwidth / width; i > 0; i--) {
+ p = (i == 2) ? right : left;
+
+ subline = line & ((1 << width) - 1);
+ subline <<= (howmany(width, 8) * 8) - width;
+
+ if (wbytes == 1) {
+ *p = subline;
+ } else if (wbytes == 2) {
+ *p++ = subline >> 8;
+ *p = subline;
+ } else {
+ errx(1, "Unsupported wbytes %u!\n", wbytes);
+ }
+
+ line >>= width;
+ }
+
+ return (0);
+}
+
+static int
+parse_bdf(FILE *fp, unsigned int map_idx)
+{
+ char *ln;
+ size_t length;
+ uint8_t bytes[wbytes * height], bytes_r[wbytes * height];
+ unsigned int curchar = 0, dwidth = 0, i, line;
+
+ while ((ln = fgetln(fp, &length)) != NULL) {
+ ln[length - 1] = '\0';
+
+ if (strncmp(ln, "ENCODING ", 9) == 0) {
+ curchar = atoi(ln + 9);
+ }
+
+ if (strncmp(ln, "DWIDTH ", 7) == 0) {
+ dwidth = atoi(ln + 7);
+ }
+
+ if (strncmp(ln, "BITMAP", 6) == 0 &&
+ (ln[6] == ' ' || ln[6] == '\0')) {
+ for (i = 0; i < height; i++) {
+ if ((ln = fgetln(fp, &length)) == NULL)
+ errx(1, "Unexpected EOF!\n");
+ ln[length - 1] = '\0';
+ sscanf(ln, "%x", &line);
+ if (parse_bitmap_line(bytes + i * wbytes,
+ bytes_r + i * wbytes, line, dwidth) != 0)
+ return (1);
+ }
+
+ if (add_char(curchar, map_idx, bytes,
+ dwidth == width * 2 ? bytes_r : NULL) != 0)
+ return (1);
+ }
+ }
+
+ return (0);
+}
+
+static void
+set_width(int w)
+{
+
+ if (w <= 0 || w > 128)
+ errx(1, "invalid width %d", w);
+ width = w;
+ wbytes = howmany(width, 8);
+}
+
+static int
+parse_hex(FILE *fp, unsigned int map_idx)
+{
+ char *ln, *p;
+ char fmt_str[8];
+ size_t length;
+ uint8_t bytes[wbytes * height], bytes_r[wbytes * height];
+ unsigned curchar = 0, i, line, chars_per_row, dwidth;
+
+ while ((ln = fgetln(fp, &length)) != NULL) {
+ ln[length - 1] = '\0';
+
+ if (strncmp(ln, "# Height: ", 10) == 0) {
+ height = atoi(ln + 10);
+ } else if (strncmp(ln, "# Width: ", 9) == 0) {
+ set_width(atoi(ln + 9));
+ } else if (sscanf(ln, "%4x:", &curchar)) {
+ p = ln + 5;
+ chars_per_row = strlen(p) / height;
+ dwidth = width;
+ if (chars_per_row / 2 > (width + 7) / 8)
+ dwidth *= 2; /* Double-width character. */
+ snprintf(fmt_str, sizeof(fmt_str), "%%%ux",
+ chars_per_row);
+
+ for (i = 0; i < height; i++) {
+ sscanf(p, fmt_str, &line);
+ p += chars_per_row;
+ if (parse_bitmap_line(bytes + i * wbytes,
+ bytes_r + i * wbytes, line, dwidth) != 0)
+ return (1);
+ }
+
+ if (add_char(curchar, map_idx, bytes,
+ dwidth == width * 2 ? bytes_r : NULL) != 0)
+ return (1);
+ }
+ }
+ return (0);
+}
+
+static int
+parse_file(const char *filename, unsigned int map_idx)
+{
+ FILE *fp;
+ size_t len;
+ int rv;
+
+ fp = fopen(filename, "r");
+ if (fp == NULL) {
+ perror(filename);
+ return (1);
+ }
+ len = strlen(filename);
+ if (len > 4 && strcasecmp(filename + len - 4, ".hex") == 0)
+ rv = parse_hex(fp, map_idx);
+ else
+ rv = parse_bdf(fp, map_idx);
+ fclose(fp);
+ return (rv);
+}
+
+static void
+number_glyphs(void)
+{
+ struct glyph *gl;
+ unsigned int i, idx = 0;
+
+ for (i = 0; i < VFNT_MAPS; i++)
+ TAILQ_FOREACH(gl, &glyphs[i], g_list)
+ gl->g_index = idx++;
+}
+
+static int
+write_glyphs(FILE *fp)
+{
+ struct glyph *gl;
+ unsigned int i;
+
+ for (i = 0; i < VFNT_MAPS; i++) {
+ TAILQ_FOREACH(gl, &glyphs[i], g_list)
+ if (fwrite(gl->g_data, wbytes * height, 1, fp) != 1)
+ return (1);
+ }
+ return (0);
+}
+
+static void
+fold_mappings(unsigned int map_idx)
+{
+ struct mapping_list *ml = &maps[map_idx];
+ struct mapping *mn, *mp, *mbase;
+
+ mp = mbase = TAILQ_FIRST(ml);
+ for (mp = mbase = TAILQ_FIRST(ml); mp != NULL; mp = mn) {
+ mn = TAILQ_NEXT(mp, m_list);
+ if (mn != NULL && mn->m_char == mp->m_char + 1 &&
+ mn->m_glyph->g_index == mp->m_glyph->g_index + 1)
+ continue;
+ mbase->m_length = mp->m_char - mbase->m_char + 1;
+ mbase = mp = mn;
+ map_folded_count[map_idx]++;
+ }
+}
+
+struct file_mapping {
+ uint32_t source;
+ uint16_t destination;
+ uint16_t length;
+} __packed;
+
+static int
+write_mappings(FILE *fp, unsigned int map_idx)
+{
+ struct mapping_list *ml = &maps[map_idx];
+ struct mapping *mp;
+ struct file_mapping fm;
+ unsigned int i = 0, j = 0;
+
+ TAILQ_FOREACH(mp, ml, m_list) {
+ j++;
+ if (mp->m_length > 0) {
+ i += mp->m_length;
+ fm.source = htobe32(mp->m_char);
+ fm.destination = htobe16(mp->m_glyph->g_index);
+ fm.length = htobe16(mp->m_length - 1);
+ if (fwrite(&fm, sizeof fm, 1, fp) != 1)
+ return (1);
+ }
+ }
+ assert(i == j);
+ return (0);
+}
+
+struct file_header {
+ uint8_t magic[8];
+ uint8_t width;
+ uint8_t height;
+ uint16_t pad;
+ uint32_t glyph_count;
+ uint32_t map_count[4];
+} __packed;
+
+static int
+write_fnt(const char *filename)
+{
+ FILE *fp;
+ struct file_header fh = {
+ .magic = "VFNT0002",
+ };
+
+ fp = fopen(filename, "wb");
+ if (fp == NULL) {
+ perror(filename);
+ return (1);
+ }
+
+ fh.width = width;
+ fh.height = height;
+ fh.glyph_count = htobe32(glyph_unique);
+ fh.map_count[0] = htobe32(map_folded_count[0]);
+ fh.map_count[1] = htobe32(map_folded_count[1]);
+ fh.map_count[2] = htobe32(map_folded_count[2]);
+ fh.map_count[3] = htobe32(map_folded_count[3]);
+ if (fwrite(&fh, sizeof fh, 1, fp) != 1) {
+ perror(filename);
+ fclose(fp);
+ return (1);
+ }
+
+ if (write_glyphs(fp) != 0 ||
+ write_mappings(fp, VFNT_MAP_NORMAL) != 0 ||
+ write_mappings(fp, 1) != 0 ||
+ write_mappings(fp, VFNT_MAP_BOLD) != 0 ||
+ write_mappings(fp, 3) != 0) {
+ perror(filename);
+ fclose(fp);
+ return (1);
+ }
+
+ fclose(fp);
+ return (0);
+}
+
+static void
+print_font_info(void)
+{
+ printf(
+"Statistics:\n"
+"- glyph_total: %5u\n"
+"- glyph_normal: %5u\n"
+"- glyph_normal_right: %5u\n"
+"- glyph_bold: %5u\n"
+"- glyph_bold_right: %5u\n"
+"- glyph_unique: %5u\n"
+"- glyph_dupe: %5u\n"
+"- mapping_total: %5u\n"
+"- mapping_normal: %5u\n"
+"- mapping_normal_folded: %5u\n"
+"- mapping_normal_right: %5u\n"
+"- mapping_normal_right_folded: %5u\n"
+"- mapping_bold: %5u\n"
+"- mapping_bold_folded: %5u\n"
+"- mapping_bold_right: %5u\n"
+"- mapping_bold_right_folded: %5u\n"
+"- mapping_unique: %5u\n"
+"- mapping_dupe: %5u\n",
+ glyph_total,
+ glyph_count[0],
+ glyph_count[1],
+ glyph_count[2],
+ glyph_count[3],
+ glyph_unique, glyph_dupe,
+ mapping_total,
+ map_count[0], map_folded_count[0],
+ map_count[1], map_folded_count[1],
+ map_count[2], map_folded_count[2],
+ map_count[3], map_folded_count[3],
+ mapping_unique, mapping_dupe);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int ch, val, verbose = 0;
+
+ assert(sizeof(struct file_header) == 32);
+ assert(sizeof(struct file_mapping) == 8);
+
+ while ((ch = getopt(argc, argv, "h:vw:")) != -1) {
+ switch (ch) {
+ case 'h':
+ val = atoi(optarg);
+ if (val <= 0 || val > 128)
+ errx(1, "Invalid height %d", val);
+ height = val;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'w':
+ set_width(atoi(optarg));
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 2 || argc > 3)
+ usage();
+
+ wbytes = howmany(width, 8);
+
+ if (parse_file(argv[0], VFNT_MAP_NORMAL) != 0)
+ return (1);
+ argc--;
+ argv++;
+ if (argc == 2) {
+ if (parse_file(argv[0], VFNT_MAP_BOLD) != 0)
+ return (1);
+ argc--;
+ argv++;
+ }
+ number_glyphs();
+ dedup_mapping(VFNT_MAP_BOLD);
+ dedup_mapping(VFNT_MAP_BOLD_RH);
+ fold_mappings(0);
+ fold_mappings(1);
+ fold_mappings(2);
+ fold_mappings(3);
+ if (write_fnt(argv[0]) != 0)
+ return (1);
+
+ if (verbose)
+ print_font_info();
+
+ return (0);
+}
diff --git a/usr.bin/which/which.1 b/usr.bin/which/which.1
index 52e010a..0c0dce82 100644
--- a/usr.bin/which/which.1
+++ b/usr.bin/which/which.1
@@ -78,8 +78,8 @@ command first appeared in
The
.Nm
utility was originally written in Perl and was contributed by
-.An Wolfram Schneider Aq wosch@FreeBSD.org .
+.An Wolfram Schneider Aq Mt wosch@FreeBSD.org .
The current version of
.Nm
was rewritten in C by
-.An Daniel Papasian Aq dpapasia@andrew.cmu.edu .
+.An Daniel Papasian Aq Mt dpapasia@andrew.cmu.edu .
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
index 99926b8..3f6f93a 100644
--- a/usr.bin/whois/whois.c
+++ b/usr.bin/whois/whois.c
@@ -179,10 +179,12 @@ main(int argc, char *argv[])
* back to NICHOST.
*/
if (host == NULL && country == NULL) {
- use_qnichost = 1;
- host = NICHOST;
- if (!(flags & WHOIS_QUICK))
- flags |= WHOIS_RECURSE;
+ if ((host = getenv("RA_SERVER")) == NULL) {
+ use_qnichost = 1;
+ host = NICHOST;
+ if (!(flags & WHOIS_QUICK))
+ flags |= WHOIS_RECURSE;
+ }
}
while (argc-- > 0) {
if (country != NULL) {
diff --git a/usr.bin/xlint/arch/ia64/targparam.h b/usr.bin/xlint/arch/ia64/targparam.h
deleted file mode 100644
index 7ec1038..0000000
--- a/usr.bin/xlint/arch/ia64/targparam.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $FreeBSD$ */
-/* $NetBSD: targparam.h,v 1.1 2002/01/18 20:39:18 thorpej Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Jochen Pohl for
- * The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Machine-dependent target parameters for lint1.
- */
-
-#include "lp64.h"
-
-/*
- * Should be set to 1 if the difference of two pointers is of type long
- * or the value of sizeof is of type unsigned long. Note this MUST be
- * kept in sync with the compiler!
- */
-
-#define PTRDIFF_IS_LONG 1
-#define SIZEOF_IS_ULONG 1
-
-#define FLOAT_SIZE (4 * CHAR_BIT)
-#define DOUBLE_SIZE (8 * CHAR_BIT)
-#define LDOUBLE_SIZE (16 * CHAR_BIT)
-
-#define ENUM_SIZE (4 * CHAR_BIT)
diff --git a/usr.bin/xlint/lint1/Makefile.depend b/usr.bin/xlint/lint1/Makefile.depend
index bb0ee77..d097f49 100644
--- a/usr.bin/xlint/lint1/Makefile.depend
+++ b/usr.bin/xlint/lint1/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
gnu/lib/libgcc \
include \
diff --git a/usr.bin/xlint/lint1/param.h b/usr.bin/xlint/lint1/param.h
index 27de692..94d8947 100644
--- a/usr.bin/xlint/lint1/param.h
+++ b/usr.bin/xlint/lint1/param.h
@@ -62,10 +62,7 @@
* Should be set to 1 if the difference of two pointers is of type long
* or the value of sizeof is of type unsigned long.
*/
-#ifdef __ia64__
-#define PTRDIFF_IS_LONG 1
-#define SIZEOF_IS_ULONG 1
-#elif __amd64__
+#if __amd64__
#define PTRDIFF_IS_LONG 1
#define SIZEOF_IS_ULONG 1
#elif __alpha__
diff --git a/usr.bin/yacc/tests/Makefile b/usr.bin/yacc/tests/Makefile
index f8b7d85..2dadf4e 100644
--- a/usr.bin/yacc/tests/Makefile
+++ b/usr.bin/yacc/tests/Makefile
@@ -1,41 +1,334 @@
# $FreeBSD$
+.include <bsd.own.mk>
+
+TEST_DIR= ${.CURDIR}/../../../contrib/byacc/test
+
+.PATH: ${TEST_DIR} ${TEST_DIR}/yacc
+
TESTSDIR= ${TESTSBASE}/usr.bin/yacc
-TAP_TESTS_SH= legacy_test
-
-FILESDIR= ${TESTSDIR}
-FILES= calc.y
-FILES+= calc1.y
-FILES+= calc2.y
-FILES+= calc3.y
-FILES+= code_calc.y
-FILES+= code_error.y
-FILES+= error.y
-FILES+= ftp.y
-FILES+= grammar.y
-FILES+= pure_calc.y
-FILES+= pure_error.y
-FILES+= quote_calc.y
-FILES+= quote_calc2.y
-FILES+= quote_calc3.y
-FILES+= quote_calc4.y
-FILES+= regress.00.out
-FILES+= regress.01.out
-FILES+= regress.02.out
-FILES+= regress.03.out
-FILES+= regress.04.out
-FILES+= regress.05.out
-FILES+= regress.06.out
-FILES+= regress.07.out
-FILES+= regress.08.out
-FILES+= regress.09.out
-FILES+= regress.10.out
-FILES+= regress.11.out
-FILES+= regress.12.out
-FILES+= regress.13.out
-FILES+= regress.14.out
-FILES+= regress.sh
-FILES+= undefined.y
+PLAIN_TESTS_SH= yacc_tests
+
+SCRIPTS= run_test
+SCRIPTSDIR= ${TESTSDIR}
+
+FILESGROUPS= FILEStest FILEStest_yacc
+
+FILEStestDIR= ${TESTSDIR}
+
+FILEStest+= btyacc_calc1.y
+FILEStest+= btyacc_demo.y
+FILEStest+= calc.y
+FILEStest+= calc1.y
+FILEStest+= calc2.y
+FILEStest+= calc3.y
+FILEStest+= code_calc.y
+FILEStest+= code_debug.y
+FILEStest+= code_error.y
+FILEStest+= empty.y
+FILEStest+= err_inherit1.y
+FILEStest+= err_inherit2.y
+FILEStest+= err_inherit3.y
+FILEStest+= err_inherit4.y
+FILEStest+= err_inherit5.y
+FILEStest+= err_syntax1.y
+FILEStest+= err_syntax10.y
+FILEStest+= err_syntax11.y
+FILEStest+= err_syntax12.y
+FILEStest+= err_syntax13.y
+FILEStest+= err_syntax14.y
+FILEStest+= err_syntax15.y
+FILEStest+= err_syntax16.y
+FILEStest+= err_syntax17.y
+FILEStest+= err_syntax18.y
+FILEStest+= err_syntax19.y
+FILEStest+= err_syntax2.y
+FILEStest+= err_syntax20.y
+FILEStest+= err_syntax21.y
+FILEStest+= err_syntax22.y
+FILEStest+= err_syntax23.y
+FILEStest+= err_syntax24.y
+FILEStest+= err_syntax25.y
+FILEStest+= err_syntax26.y
+FILEStest+= err_syntax27.y
+FILEStest+= err_syntax3.y
+FILEStest+= err_syntax4.y
+FILEStest+= err_syntax5.y
+FILEStest+= err_syntax6.y
+FILEStest+= err_syntax7.y
+FILEStest+= err_syntax7a.y
+FILEStest+= err_syntax7b.y
+FILEStest+= err_syntax8.y
+FILEStest+= err_syntax8a.y
+FILEStest+= err_syntax9.y
+FILEStest+= error.y
+FILEStest+= grammar.y
+FILEStest+= inherit0.y
+FILEStest+= inherit1.y
+FILEStest+= inherit2.y
+FILEStest+= ok_syntax1.y
+FILEStest+= pure_calc.y
+FILEStest+= pure_error.y
+FILEStest+= quote_calc.y
+FILEStest+= quote_calc2.y
+FILEStest+= quote_calc3.y
+FILEStest+= quote_calc4.y
+FILEStest+= varsyntax_calc1.y
+
+FILEStest_yaccDIR= ${TESTSDIR}/yacc
+
+FILEStest_yacc+= big_b.error
+FILEStest_yacc+= big_b.output
+FILEStest_yacc+= big_l.error
+FILEStest_yacc+= big_l.output
+FILEStest_yacc+= calc.error
+FILEStest_yacc+= calc.output
+FILEStest_yacc+= calc.tab.c
+FILEStest_yacc+= calc.tab.h
+FILEStest_yacc+= calc1.error
+FILEStest_yacc+= calc1.output
+FILEStest_yacc+= calc1.tab.c
+FILEStest_yacc+= calc1.tab.h
+FILEStest_yacc+= calc2.error
+FILEStest_yacc+= calc2.output
+FILEStest_yacc+= calc2.tab.c
+FILEStest_yacc+= calc2.tab.h
+FILEStest_yacc+= calc3.error
+FILEStest_yacc+= calc3.output
+FILEStest_yacc+= calc3.tab.c
+FILEStest_yacc+= calc3.tab.h
+FILEStest_yacc+= code_calc.code.c
+FILEStest_yacc+= code_calc.error
+FILEStest_yacc+= code_calc.output
+FILEStest_yacc+= code_calc.tab.c
+FILEStest_yacc+= code_calc.tab.h
+FILEStest_yacc+= code_error.code.c
+FILEStest_yacc+= code_error.error
+FILEStest_yacc+= code_error.output
+FILEStest_yacc+= code_error.tab.c
+FILEStest_yacc+= code_error.tab.h
+FILEStest_yacc+= empty.error
+FILEStest_yacc+= empty.output
+FILEStest_yacc+= empty.tab.c
+FILEStest_yacc+= empty.tab.h
+FILEStest_yacc+= err_syntax1.error
+FILEStest_yacc+= err_syntax1.output
+FILEStest_yacc+= err_syntax1.tab.c
+FILEStest_yacc+= err_syntax1.tab.h
+FILEStest_yacc+= err_syntax10.error
+FILEStest_yacc+= err_syntax10.output
+FILEStest_yacc+= err_syntax10.tab.c
+FILEStest_yacc+= err_syntax10.tab.h
+FILEStest_yacc+= err_syntax11.error
+FILEStest_yacc+= err_syntax11.output
+FILEStest_yacc+= err_syntax11.tab.c
+FILEStest_yacc+= err_syntax11.tab.h
+FILEStest_yacc+= err_syntax12.error
+FILEStest_yacc+= err_syntax12.output
+FILEStest_yacc+= err_syntax12.tab.c
+FILEStest_yacc+= err_syntax12.tab.h
+FILEStest_yacc+= err_syntax13.error
+FILEStest_yacc+= err_syntax13.output
+FILEStest_yacc+= err_syntax13.tab.c
+FILEStest_yacc+= err_syntax13.tab.h
+FILEStest_yacc+= err_syntax14.error
+FILEStest_yacc+= err_syntax14.output
+FILEStest_yacc+= err_syntax14.tab.c
+FILEStest_yacc+= err_syntax14.tab.h
+FILEStest_yacc+= err_syntax15.error
+FILEStest_yacc+= err_syntax15.output
+FILEStest_yacc+= err_syntax15.tab.c
+FILEStest_yacc+= err_syntax15.tab.h
+FILEStest_yacc+= err_syntax16.error
+FILEStest_yacc+= err_syntax16.output
+FILEStest_yacc+= err_syntax16.tab.c
+FILEStest_yacc+= err_syntax16.tab.h
+FILEStest_yacc+= err_syntax17.error
+FILEStest_yacc+= err_syntax17.output
+FILEStest_yacc+= err_syntax17.tab.c
+FILEStest_yacc+= err_syntax17.tab.h
+FILEStest_yacc+= err_syntax18.error
+FILEStest_yacc+= err_syntax18.output
+FILEStest_yacc+= err_syntax18.tab.c
+FILEStest_yacc+= err_syntax18.tab.h
+FILEStest_yacc+= err_syntax19.error
+FILEStest_yacc+= err_syntax19.output
+FILEStest_yacc+= err_syntax19.tab.c
+FILEStest_yacc+= err_syntax19.tab.h
+FILEStest_yacc+= err_syntax2.error
+FILEStest_yacc+= err_syntax2.output
+FILEStest_yacc+= err_syntax2.tab.c
+FILEStest_yacc+= err_syntax2.tab.h
+FILEStest_yacc+= err_syntax20.error
+FILEStest_yacc+= err_syntax20.output
+FILEStest_yacc+= err_syntax20.tab.c
+FILEStest_yacc+= err_syntax20.tab.h
+FILEStest_yacc+= err_syntax21.error
+FILEStest_yacc+= err_syntax21.output
+FILEStest_yacc+= err_syntax21.tab.c
+FILEStest_yacc+= err_syntax21.tab.h
+FILEStest_yacc+= err_syntax22.error
+FILEStest_yacc+= err_syntax22.output
+FILEStest_yacc+= err_syntax22.tab.c
+FILEStest_yacc+= err_syntax22.tab.h
+FILEStest_yacc+= err_syntax23.error
+FILEStest_yacc+= err_syntax23.output
+FILEStest_yacc+= err_syntax23.tab.c
+FILEStest_yacc+= err_syntax23.tab.h
+FILEStest_yacc+= err_syntax24.error
+FILEStest_yacc+= err_syntax24.output
+FILEStest_yacc+= err_syntax24.tab.c
+FILEStest_yacc+= err_syntax24.tab.h
+FILEStest_yacc+= err_syntax25.error
+FILEStest_yacc+= err_syntax25.output
+FILEStest_yacc+= err_syntax25.tab.c
+FILEStest_yacc+= err_syntax25.tab.h
+FILEStest_yacc+= err_syntax26.error
+FILEStest_yacc+= err_syntax26.output
+FILEStest_yacc+= err_syntax26.tab.c
+FILEStest_yacc+= err_syntax26.tab.h
+FILEStest_yacc+= err_syntax27.error
+FILEStest_yacc+= err_syntax27.output
+FILEStest_yacc+= err_syntax27.tab.c
+FILEStest_yacc+= err_syntax27.tab.h
+FILEStest_yacc+= err_syntax3.error
+FILEStest_yacc+= err_syntax3.output
+FILEStest_yacc+= err_syntax3.tab.c
+FILEStest_yacc+= err_syntax3.tab.h
+FILEStest_yacc+= err_syntax4.error
+FILEStest_yacc+= err_syntax4.output
+FILEStest_yacc+= err_syntax4.tab.c
+FILEStest_yacc+= err_syntax4.tab.h
+FILEStest_yacc+= err_syntax5.error
+FILEStest_yacc+= err_syntax5.output
+FILEStest_yacc+= err_syntax5.tab.c
+FILEStest_yacc+= err_syntax5.tab.h
+FILEStest_yacc+= err_syntax6.error
+FILEStest_yacc+= err_syntax6.output
+FILEStest_yacc+= err_syntax6.tab.c
+FILEStest_yacc+= err_syntax6.tab.h
+FILEStest_yacc+= err_syntax7.error
+FILEStest_yacc+= err_syntax7.output
+FILEStest_yacc+= err_syntax7.tab.c
+FILEStest_yacc+= err_syntax7.tab.h
+FILEStest_yacc+= err_syntax7a.error
+FILEStest_yacc+= err_syntax7a.output
+FILEStest_yacc+= err_syntax7a.tab.c
+FILEStest_yacc+= err_syntax7a.tab.h
+FILEStest_yacc+= err_syntax7b.error
+FILEStest_yacc+= err_syntax7b.output
+FILEStest_yacc+= err_syntax7b.tab.c
+FILEStest_yacc+= err_syntax7b.tab.h
+FILEStest_yacc+= err_syntax8.error
+FILEStest_yacc+= err_syntax8.output
+FILEStest_yacc+= err_syntax8.tab.c
+FILEStest_yacc+= err_syntax8.tab.h
+FILEStest_yacc+= err_syntax8a.error
+FILEStest_yacc+= err_syntax8a.output
+FILEStest_yacc+= err_syntax8a.tab.c
+FILEStest_yacc+= err_syntax8a.tab.h
+FILEStest_yacc+= err_syntax9.error
+FILEStest_yacc+= err_syntax9.output
+FILEStest_yacc+= err_syntax9.tab.c
+FILEStest_yacc+= err_syntax9.tab.h
+FILEStest_yacc+= error.error
+FILEStest_yacc+= error.output
+FILEStest_yacc+= error.tab.c
+FILEStest_yacc+= error.tab.h
+FILEStest_yacc+= grammar.dot
+FILEStest_yacc+= grammar.error
+FILEStest_yacc+= grammar.output
+FILEStest_yacc+= grammar.tab.c
+FILEStest_yacc+= grammar.tab.h
+FILEStest_yacc+= help.error
+FILEStest_yacc+= help.output
+FILEStest_yacc+= no_b_opt.error
+FILEStest_yacc+= no_b_opt.output
+# XXX: expected: `f - cannot open "nosuchfile.c"; gets
+# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
+#FILEStest_yacc+= no_b_opt1.error
+#FILEStest_yacc+= no_b_opt1.output
+#FILEStest_yacc+= no_code_c.error
+#FILEStest_yacc+= no_code_c.output
+#FILEStest_yacc+= no_defines.error
+#FILEStest_yacc+= no_defines.output
+#FILEStest_yacc+= no_graph.error
+#FILEStest_yacc+= no_graph.output
+#FILEStest_yacc+= no_include.error
+#FILEStest_yacc+= no_include.output
+FILEStest_yacc+= no_opts.error
+FILEStest_yacc+= no_opts.output
+# XXX: expected: `f - cannot open "nosuchfile.c"; gets
+# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
+#FILEStest_yacc+= no_output.error
+#FILEStest_yacc+= no_output.output
+#FILEStest_yacc+= no_output1.error
+#FILEStest_yacc+= no_output1.output
+FILEStest_yacc+= no_output2.error
+FILEStest_yacc+= no_output2.output
+FILEStest_yacc+= no_p_opt.error
+FILEStest_yacc+= no_p_opt.output
+# XXX: expected: `f - cannot open "nosuchfile.c"; gets
+# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
+#FILEStest_yacc+= no_p_opt1.error
+#FILEStest_yacc+= no_p_opt1.output
+#FILEStest_yacc+= no_verbose.error
+#FILEStest_yacc+= no_verbose.output
+FILEStest_yacc+= nostdin.error
+FILEStest_yacc+= nostdin.output
+FILEStest_yacc+= ok_syntax1.error
+FILEStest_yacc+= ok_syntax1.output
+FILEStest_yacc+= ok_syntax1.tab.c
+FILEStest_yacc+= ok_syntax1.tab.h
+FILEStest_yacc+= pure_calc.error
+FILEStest_yacc+= pure_calc.output
+FILEStest_yacc+= pure_calc.tab.c
+FILEStest_yacc+= pure_calc.tab.h
+FILEStest_yacc+= pure_error.error
+FILEStest_yacc+= pure_error.output
+FILEStest_yacc+= pure_error.tab.c
+FILEStest_yacc+= pure_error.tab.h
+FILEStest_yacc+= quote_calc-s.error
+FILEStest_yacc+= quote_calc-s.output
+FILEStest_yacc+= quote_calc-s.tab.c
+FILEStest_yacc+= quote_calc-s.tab.h
+FILEStest_yacc+= quote_calc.error
+FILEStest_yacc+= quote_calc.output
+FILEStest_yacc+= quote_calc.tab.c
+FILEStest_yacc+= quote_calc.tab.h
+FILEStest_yacc+= quote_calc2-s.error
+FILEStest_yacc+= quote_calc2-s.output
+FILEStest_yacc+= quote_calc2-s.tab.c
+FILEStest_yacc+= quote_calc2-s.tab.h
+FILEStest_yacc+= quote_calc2.error
+FILEStest_yacc+= quote_calc2.output
+FILEStest_yacc+= quote_calc2.tab.c
+FILEStest_yacc+= quote_calc2.tab.h
+FILEStest_yacc+= quote_calc3-s.error
+FILEStest_yacc+= quote_calc3-s.output
+FILEStest_yacc+= quote_calc3-s.tab.c
+FILEStest_yacc+= quote_calc3-s.tab.h
+FILEStest_yacc+= quote_calc3.error
+FILEStest_yacc+= quote_calc3.output
+FILEStest_yacc+= quote_calc3.tab.c
+FILEStest_yacc+= quote_calc3.tab.h
+FILEStest_yacc+= quote_calc4-s.error
+FILEStest_yacc+= quote_calc4-s.output
+FILEStest_yacc+= quote_calc4-s.tab.c
+FILEStest_yacc+= quote_calc4-s.tab.h
+FILEStest_yacc+= quote_calc4.error
+FILEStest_yacc+= quote_calc4.output
+FILEStest_yacc+= quote_calc4.tab.c
+FILEStest_yacc+= quote_calc4.tab.h
+FILEStest_yacc+= rename_debug.c
+FILEStest_yacc+= rename_debug.error
+FILEStest_yacc+= rename_debug.h
+FILEStest_yacc+= rename_debug.i
+FILEStest_yacc+= rename_debug.output
+FILEStest_yacc+= varsyntax_calc1.error
+FILEStest_yacc+= varsyntax_calc1.output
+FILEStest_yacc+= varsyntax_calc1.tab.c
+FILEStest_yacc+= varsyntax_calc1.tab.h
.include <bsd.test.mk>
diff --git a/usr.bin/yacc/tests/calc.y b/usr.bin/yacc/tests/calc.y
deleted file mode 100644
index c2e5a89..0000000
--- a/usr.bin/yacc/tests/calc.y
+++ /dev/null
@@ -1,106 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-extern int yylex(void);
-static void yyerror(const char *s);
-
-%}
-
-%start list
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr '+' expr
- { $$ = $1 + $3; }
- | expr '-' expr
- { $$ = $1 - $3; }
- | expr '*' expr
- { $$ = $1 * $3; }
- | expr '/' expr
- { $$ = $1 / $3; }
- | expr '%' expr
- { $$ = $1 % $3; }
- | expr '&' expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | '-' expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/calc1.y b/usr.bin/yacc/tests/calc1.y
deleted file mode 100644
index ec89736..0000000
--- a/usr.bin/yacc/tests/calc1.y
+++ /dev/null
@@ -1,305 +0,0 @@
-%{
-
-/* http://dinosaur.compilertools.net/yacc/index.html */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-
-typedef struct interval
-{
- double lo, hi;
-}
-INTERVAL;
-
-INTERVAL vmul(double, double, INTERVAL);
-INTERVAL vdiv(double, double, INTERVAL);
-
-extern int yylex(void);
-static void yyerror(const char *s);
-
-int dcheck(INTERVAL);
-
-double dreg[26];
-INTERVAL vreg[26];
-
-%}
-%expect 18
-
-%start line
-%union
-{
- int ival;
- double dval;
- INTERVAL vval;
-}
-
-%token <ival> DREG VREG /* indices into dreg, vreg arrays */
-%token <dval> CONST /* floating point constant */
-
-%type <dval> dexp /* expression */
-%type <vval> vexp /* interval expression */
-
- /* precedence information about the operators */
-
-%left '+' '-'
-%left '*' '/'
-%left UMINUS /* precedence for unary minus */
-
-%% /* beginning of rules section */
-
-lines : /* empty */
- | lines line
- ;
-
-line : dexp '\n'
- {
- (void) printf("%15.8f\n", $1);
- }
- | vexp '\n'
- {
- (void) printf("(%15.8f, %15.8f)\n", $1.lo, $1.hi);
- }
- | DREG '=' dexp '\n'
- {
- dreg[$1] = $3;
- }
- | VREG '=' vexp '\n'
- {
- vreg[$1] = $3;
- }
- | error '\n'
- {
- yyerrok;
- }
- ;
-
-dexp : CONST
- | DREG
- {
- $$ = dreg[$1];
- }
- | dexp '+' dexp
- {
- $$ = $1 + $3;
- }
- | dexp '-' dexp
- {
- $$ = $1 - $3;
- }
- | dexp '*' dexp
- {
- $$ = $1 * $3;
- }
- | dexp '/' dexp
- {
- $$ = $1 / $3;
- }
- | '-' dexp %prec UMINUS
- {
- $$ = -$2;
- }
- | '(' dexp ')'
- {
- $$ = $2;
- }
- ;
-
-vexp : dexp
- {
- $$.hi = $$.lo = $1;
- }
- | '(' dexp ',' dexp ')'
- {
- $$.lo = $2;
- $$.hi = $4;
- if ( $$.lo > $$.hi )
- {
- (void) printf("interval out of order\n");
- YYERROR;
- }
- }
- | VREG
- {
- $$ = vreg[$1];
- }
- | vexp '+' vexp
- {
- $$.hi = $1.hi + $3.hi;
- $$.lo = $1.lo + $3.lo;
- }
- | dexp '+' vexp
- {
- $$.hi = $1 + $3.hi;
- $$.lo = $1 + $3.lo;
- }
- | vexp '-' vexp
- {
- $$.hi = $1.hi - $3.lo;
- $$.lo = $1.lo - $3.hi;
- }
- | dexp '-' vexp
- {
- $$.hi = $1 - $3.lo;
- $$.lo = $1 - $3.hi;
- }
- | vexp '*' vexp
- {
- $$ = vmul( $1.lo, $1.hi, $3 );
- }
- | dexp '*' vexp
- {
- $$ = vmul ($1, $1, $3 );
- }
- | vexp '/' vexp
- {
- if (dcheck($3)) YYERROR;
- $$ = vdiv ( $1.lo, $1.hi, $3 );
- }
- | dexp '/' vexp
- {
- if (dcheck ( $3 )) YYERROR;
- $$ = vdiv ($1, $1, $3 );
- }
- | '-' vexp %prec UMINUS
- {
- $$.hi = -$2.lo;
- $$.lo = -$2.hi;
- }
- | '(' vexp ')'
- {
- $$ = $2;
- }
- ;
-
-%% /* beginning of subroutines section */
-
-#define BSZ 50 /* buffer size for floating point numbers */
-
- /* lexical analysis */
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- int c;
-
- while ((c = getchar()) == ' ')
- { /* skip over blanks */
- }
-
- if (isupper(c))
- {
- yylval.ival = c - 'A';
- return (VREG);
- }
- if (islower(c))
- {
- yylval.ival = c - 'a';
- return (DREG);
- }
-
- if (isdigit(c) || c == '.')
- {
- /* gobble up digits, points, exponents */
- char buf[BSZ + 1], *cp = buf;
- int dot = 0, expr = 0;
-
- for (; (cp - buf) < BSZ; ++cp, c = getchar())
- {
-
- *cp = c;
- if (isdigit(c))
- continue;
- if (c == '.')
- {
- if (dot++ || expr)
- return ('.'); /* will cause syntax error */
- continue;
- }
-
- if (c == 'e')
- {
- if (expr++)
- return ('e'); /* will cause syntax error */
- continue;
- }
-
- /* end of number */
- break;
- }
- *cp = '\0';
-
- if ((cp - buf) >= BSZ)
- printf("constant too long: truncated\n");
- else
- ungetc(c, stdin); /* push back last char read */
- yylval.dval = atof(buf);
- return (CONST);
- }
- return (c);
-}
-
-static INTERVAL
-hilo(double a, double b, double c, double d)
-{
- /* returns the smallest interval containing a, b, c, and d */
- /* used by *, / routines */
- INTERVAL v;
-
- if (a > b)
- {
- v.hi = a;
- v.lo = b;
- }
- else
- {
- v.hi = b;
- v.lo = a;
- }
-
- if (c > d)
- {
- if (c > v.hi)
- v.hi = c;
- if (d < v.lo)
- v.lo = d;
- }
- else
- {
- if (d > v.hi)
- v.hi = d;
- if (c < v.lo)
- v.lo = c;
- }
- return (v);
-}
-
-INTERVAL
-vmul(double a, double b, INTERVAL v)
-{
- return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
-}
-
-int
-dcheck(INTERVAL v)
-{
- if (v.hi >= 0. && v.lo <= 0.)
- {
- printf("divisor interval contains 0.\n");
- return (1);
- }
- return (0);
-}
-
-INTERVAL
-vdiv(double a, double b, INTERVAL v)
-{
- return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
-}
diff --git a/usr.bin/yacc/tests/calc2.y b/usr.bin/yacc/tests/calc2.y
deleted file mode 100644
index e742ff3..0000000
--- a/usr.bin/yacc/tests/calc2.y
+++ /dev/null
@@ -1,120 +0,0 @@
-%parse-param { int regs[26] }
-%parse-param { int *base }
-
-%lex-param { int *base }
-
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-#ifdef YYBISON
-#define YYLEX_PARAM base
-#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
-#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-%}
-
-%start list
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr '+' expr
- { $$ = $1 + $3; }
- | expr '-' expr
- { $$ = $1 - $3; }
- | expr '*' expr
- { $$ = $1 * $3; }
- | expr '/' expr
- { $$ = $1 / $3; }
- | expr '%' expr
- { $$ = $1 % $3; }
- | expr '&' expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | '-' expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = (*base) * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- int regs[26];
- int base = 10;
-
- while(!feof(stdin)) {
- yyparse(regs, &base);
- }
- return 0;
-}
-
-static void
-YYERROR_DECL()
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-YYLEX_DECL()
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = (c - '0') % (*base);
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/calc3.y b/usr.bin/yacc/tests/calc3.y
deleted file mode 100644
index 252faa9..0000000
--- a/usr.bin/yacc/tests/calc3.y
+++ /dev/null
@@ -1,123 +0,0 @@
-%pure-parser
-
-%parse-param { int regs[26] }
-%parse-param { int *base }
-
-%lex-param { int *base }
-
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM base
-#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
-#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-%}
-
-%start list
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr '+' expr
- { $$ = $1 + $3; }
- | expr '-' expr
- { $$ = $1 - $3; }
- | expr '*' expr
- { $$ = $1 * $3; }
- | expr '/' expr
- { $$ = $1 / $3; }
- | expr '%' expr
- { $$ = $1 % $3; }
- | expr '&' expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | '-' expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = (*base) * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- int regs[26];
- int base = 10;
-
- while(!feof(stdin)) {
- yyparse(regs, &base);
- }
- return 0;
-}
-
-static void
-YYERROR_DECL()
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-YYLEX_DECL()
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- *yylval = (c - 'a');
- return ( LETTER );
- }
- if( isdigit( c )) {
- *yylval = (c - '0') % (*base);
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/code_calc.y b/usr.bin/yacc/tests/code_calc.y
deleted file mode 100644
index 0a99456..0000000
--- a/usr.bin/yacc/tests/code_calc.y
+++ /dev/null
@@ -1,112 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *s);
-#endif
-
-%}
-
-%start list
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr '+' expr
- { $$ = $1 + $3; }
- | expr '-' expr
- { $$ = $1 - $3; }
- | expr '*' expr
- { $$ = $1 * $3; }
- | expr '/' expr
- { $$ = $1 / $3; }
- | expr '%' expr
- { $$ = $1 % $3; }
- | expr '&' expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | '-' expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/code_error.y b/usr.bin/yacc/tests/code_error.y
deleted file mode 100644
index bb77156..0000000
--- a/usr.bin/yacc/tests/code_error.y
+++ /dev/null
@@ -1,36 +0,0 @@
-%{
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *);
-#endif
-
-%}
-%%
-S: error
-%%
-
-#include <stdio.h>
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(void)
-{
- return -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
diff --git a/usr.bin/yacc/tests/error.y b/usr.bin/yacc/tests/error.y
deleted file mode 100644
index 673c68d..0000000
--- a/usr.bin/yacc/tests/error.y
+++ /dev/null
@@ -1,28 +0,0 @@
-%{
-int yylex(void);
-static void yyerror(const char *);
-%}
-%%
-S: error
-%%
-
-#include <stdio.h>
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(void)
-{
- return -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
diff --git a/usr.bin/yacc/tests/ftp.y b/usr.bin/yacc/tests/ftp.y
deleted file mode 100644
index 42c210b..0000000
--- a/usr.bin/yacc/tests/ftp.y
+++ /dev/null
@@ -1,1228 +0,0 @@
-/*
- * Copyright (c) 1985, 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89
- */
-
-/*
- * Grammar for FTP commands.
- * See RFC 959.
- */
-
-%{
-
-/* sccsid[] = "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89"; */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <arpa/ftp.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <setjmp.h>
-#include <syslog.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *);
-#endif
-
-extern struct sockaddr_in data_dest;
-extern int logged_in;
-extern struct passwd *pw;
-extern int guest;
-extern int logging;
-extern int type;
-extern int form;
-extern int debug;
-extern int timeout;
-extern int maxtimeout;
-extern int pdata;
-extern char hostname[], remotehost[];
-extern char proctitle[];
-extern char *globerr;
-extern int usedefault;
-extern int transflag;
-extern char tmpline[];
-
-extern char **glob(char *);
-extern char *renamefrom(char *);
-extern void cwd(const char *);
-
-extern void dologout(int);
-extern void fatal(const char *);
-extern void makedir(const char *);
-extern void nack(const char *);
-extern void pass(const char *);
-extern void passive(void);
-extern void pwd(void);
-extern void removedir(char *);
-extern void renamecmd(char *, char *);
-extern void retrieve(const char *, const char *);
-extern void send_file_list(const char *);
-extern void statcmd(void);
-extern void statfilecmd(const char *);
-extern void store(char *, const char *, int);
-extern void user(const char *);
-
-extern void perror_reply(int, const char *, ...);
-extern void reply(int, const char *, ...);
-extern void lreply(int, const char *, ...);
-
-static int cmd_type;
-static int cmd_form;
-static int cmd_bytesz;
-char cbuf[512];
-char *fromname;
-
-struct tab {
- const char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- const char *help;
-};
-
-static char * copy(const char *);
-
-#ifdef YYBISON
-static void sizecmd(char *filename);
-static void help(struct tab *ctab, char *s);
-struct tab cmdtab[];
-struct tab sitetab[];
-#endif
-
-static void
-yyerror(const char *msg)
-{
- perror(msg);
-}
-%}
-
-%token
- A B C E F I
- L N P R S T
-
- SP CRLF COMMA STRING NUMBER
-
- USER PASS ACCT REIN QUIT PORT
- PASV TYPE STRU MODE RETR STOR
- APPE MLFL MAIL MSND MSOM MSAM
- MRSQ MRCP ALLO REST RNFR RNTO
- ABOR DELE CWD LIST NLST SITE
- STAT HELP NOOP MKD RMD PWD
- CDUP STOU SMNT SYST SIZE MDTM
-
- UMASK IDLE CHMOD
-
- LEXERR
-
-%start cmd_list
-
-%%
-
-cmd_list: /* empty */
- | cmd_list cmd
- {
- fromname = (char *) 0;
- }
- | cmd_list rcmd
- ;
-
-cmd: USER SP username CRLF
- {
- user((char *) $3);
- free((char *) $3);
- }
- | PASS SP password CRLF
- {
- pass((char *) $3);
- free((char *) $3);
- }
- | PORT SP host_port CRLF
- {
- usedefault = 0;
- if (pdata >= 0) {
- (void) close(pdata);
- pdata = -1;
- }
- reply(200, "PORT command successful.");
- }
- | PASV CRLF
- {
- passive();
- }
- | TYPE SP type_code CRLF
- {
- switch (cmd_type) {
-
- case TYPE_A:
- if (cmd_form == FORM_N) {
- reply(200, "Type set to A.");
- type = cmd_type;
- form = cmd_form;
- } else
- reply(504, "Form must be N.");
- break;
-
- case TYPE_E:
- reply(504, "Type E not implemented.");
- break;
-
- case TYPE_I:
- reply(200, "Type set to I.");
- type = cmd_type;
- break;
-
- case TYPE_L:
-#if NBBY == 8
- if (cmd_bytesz == 8) {
- reply(200,
- "Type set to L (byte size 8).");
- type = cmd_type;
- } else
- reply(504, "Byte size must be 8.");
-#else /* NBBY == 8 */
- UNIMPLEMENTED for NBBY != 8
-#endif /* NBBY == 8 */
- }
- }
- | STRU SP struct_code CRLF
- {
- switch ($3) {
-
- case STRU_F:
- reply(200, "STRU F ok.");
- break;
-
- default:
- reply(504, "Unimplemented STRU type.");
- }
- }
- | MODE SP mode_code CRLF
- {
- switch ($3) {
-
- case MODE_S:
- reply(200, "MODE S ok.");
- break;
-
- default:
- reply(502, "Unimplemented MODE type.");
- }
- }
- | ALLO SP NUMBER CRLF
- {
- reply(202, "ALLO command ignored.");
- }
- | ALLO SP NUMBER SP R SP NUMBER CRLF
- {
- reply(202, "ALLO command ignored.");
- }
- | RETR check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- retrieve((char *) 0, (char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | STOR check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- store((char *) $4, "w", 0);
- if ($4 != 0)
- free((char *) $4);
- }
- | APPE check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- store((char *) $4, "a", 0);
- if ($4 != 0)
- free((char *) $4);
- }
- | NLST check_login CRLF
- {
- if ($2)
- send_file_list(".");
- }
- | NLST check_login SP STRING CRLF
- {
- if ($2 && $4 != 0)
- send_file_list((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | LIST check_login CRLF
- {
- if ($2)
- retrieve("/bin/ls -lgA", "");
- }
- | LIST check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- retrieve("/bin/ls -lgA %s", (char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | STAT check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- statfilecmd((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | STAT CRLF
- {
- statcmd();
- }
- | DELE check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- remove((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | RNTO SP pathname CRLF
- {
- if (fromname) {
- renamecmd(fromname, (char *) $3);
- free(fromname);
- fromname = (char *) 0;
- } else {
- reply(503, "Bad sequence of commands.");
- }
- free((char *) $3);
- }
- | ABOR CRLF
- {
- reply(225, "ABOR command successful.");
- }
- | CWD check_login CRLF
- {
- if ($2)
- cwd(pw->pw_dir);
- }
- | CWD check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- cwd((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | HELP CRLF
- {
- help(cmdtab, (char *) 0);
- }
- | HELP SP STRING CRLF
- {
- register char *cp = (char *)$3;
-
- if (strncasecmp(cp, "SITE", 4) == 0) {
- cp = (char *)$3 + 4;
- if (*cp == ' ')
- cp++;
- if (*cp)
- help(sitetab, cp);
- else
- help(sitetab, (char *) 0);
- } else
- help(cmdtab, (char *) $3);
- }
- | NOOP CRLF
- {
- reply(200, "NOOP command successful.");
- }
- | MKD check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- makedir((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | RMD check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- removedir((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
- | PWD check_login CRLF
- {
- if ($2)
- pwd();
- }
- | CDUP check_login CRLF
- {
- if ($2)
- cwd("..");
- }
- | SITE SP HELP CRLF
- {
- help(sitetab, (char *) 0);
- }
- | SITE SP HELP SP STRING CRLF
- {
- help(sitetab, (char *) $5);
- }
- | SITE SP UMASK check_login CRLF
- {
- int oldmask;
-
- if ($4) {
- oldmask = umask(0);
- (void) umask(oldmask);
- reply(200, "Current UMASK is %03o", oldmask);
- }
- }
- | SITE SP UMASK check_login SP octal_number CRLF
- {
- int oldmask;
-
- if ($4) {
- if (($6 == -1) || ($6 > 0777)) {
- reply(501, "Bad UMASK value");
- } else {
- oldmask = umask($6);
- reply(200,
- "UMASK set to %03o (was %03o)",
- $6, oldmask);
- }
- }
- }
- | SITE SP CHMOD check_login SP octal_number SP pathname CRLF
- {
- if ($4 && ($8 != 0)) {
- if ($6 > 0777)
- reply(501,
- "CHMOD: Mode value must be between 0 and 0777");
- else if (chmod((char *) $8, $6) < 0)
- perror_reply(550, (char *) $8);
- else
- reply(200, "CHMOD command successful.");
- }
- if ($8 != 0)
- free((char *) $8);
- }
- | SITE SP IDLE CRLF
- {
- reply(200,
- "Current IDLE time limit is %d seconds; max %d",
- timeout, maxtimeout);
- }
- | SITE SP IDLE SP NUMBER CRLF
- {
- if ($5 < 30 || $5 > maxtimeout) {
- reply(501,
- "Maximum IDLE time must be between 30 and %d seconds",
- maxtimeout);
- } else {
- timeout = $5;
- (void) alarm((unsigned) timeout);
- reply(200,
- "Maximum IDLE time set to %d seconds",
- timeout);
- }
- }
- | STOU check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- store((char *) $4, "w", 1);
- if ($4 != 0)
- free((char *) $4);
- }
- | SYST CRLF
- {
-#ifdef unix
-#ifdef BSD
- reply(215, "UNIX Type: L%d Version: BSD-%d",
- NBBY, BSD);
-#else /* BSD */
- reply(215, "UNIX Type: L%d", NBBY);
-#endif /* BSD */
-#else /* unix */
- reply(215, "UNKNOWN Type: L%d", NBBY);
-#endif /* unix */
- }
-
- /*
- * SIZE is not in RFC959, but Postel has blessed it and
- * it will be in the updated RFC.
- *
- * Return size of file in a format suitable for
- * using with RESTART (we just count bytes).
- */
- | SIZE check_login SP pathname CRLF
- {
- if ($2 && $4 != 0)
- sizecmd((char *) $4);
- if ($4 != 0)
- free((char *) $4);
- }
-
- /*
- * MDTM is not in RFC959, but Postel has blessed it and
- * it will be in the updated RFC.
- *
- * Return modification time of file as an ISO 3307
- * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
- * where xxx is the fractional second (of any precision,
- * not necessarily 3 digits)
- */
- | MDTM check_login SP pathname CRLF
- {
- if ($2 && $4 != 0) {
- struct stat stbuf;
- if (stat((char *) $4, &stbuf) < 0)
- perror_reply(550, "%s", (char *) $4);
- else if ((stbuf.st_mode&S_IFMT) != S_IFREG) {
- reply(550, "%s: not a plain file.",
- (char *) $4);
- } else {
- register struct tm *t;
- t = gmtime(&stbuf.st_mtime);
- reply(213,
- "%04d%02d%02d%02d%02d%02d",
- 1900 + t->tm_year,
- t->tm_mon+1, t->tm_mday,
- t->tm_hour, t->tm_min, t->tm_sec);
- }
- }
- if ($4 != 0)
- free((char *) $4);
- }
- | QUIT CRLF
- {
- reply(221, "Goodbye.");
- dologout(0);
- }
- | error CRLF
- {
- yyerrok;
- }
- ;
-rcmd: RNFR check_login SP pathname CRLF
- {
- if ($2 && $4) {
- fromname = renamefrom((char *) $4);
- if (fromname == (char *) 0 && $4) {
- free((char *) $4);
- }
- }
- }
- ;
-
-username: STRING
- ;
-
-password: /* empty */
- {
- *(const char **)(&($$)) = "";
- }
- | STRING
- ;
-
-byte_size: NUMBER
- ;
-
-host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
- NUMBER COMMA NUMBER
- {
- register char *a, *p;
-
- a = (char *)&data_dest.sin_addr;
- a[0] = $1; a[1] = $3; a[2] = $5; a[3] = $7;
- p = (char *)&data_dest.sin_port;
- p[0] = $9; p[1] = $11;
- data_dest.sin_family = AF_INET;
- }
- ;
-
-form_code: N
- {
- $$ = FORM_N;
- }
- | T
- {
- $$ = FORM_T;
- }
- | C
- {
- $$ = FORM_C;
- }
- ;
-
-type_code: A
- {
- cmd_type = TYPE_A;
- cmd_form = FORM_N;
- }
- | A SP form_code
- {
- cmd_type = TYPE_A;
- cmd_form = $3;
- }
- | E
- {
- cmd_type = TYPE_E;
- cmd_form = FORM_N;
- }
- | E SP form_code
- {
- cmd_type = TYPE_E;
- cmd_form = $3;
- }
- | I
- {
- cmd_type = TYPE_I;
- }
- | L
- {
- cmd_type = TYPE_L;
- cmd_bytesz = NBBY;
- }
- | L SP byte_size
- {
- cmd_type = TYPE_L;
- cmd_bytesz = $3;
- }
- /* this is for a bug in the BBN ftp */
- | L byte_size
- {
- cmd_type = TYPE_L;
- cmd_bytesz = $2;
- }
- ;
-
-struct_code: F
- {
- $$ = STRU_F;
- }
- | R
- {
- $$ = STRU_R;
- }
- | P
- {
- $$ = STRU_P;
- }
- ;
-
-mode_code: S
- {
- $$ = MODE_S;
- }
- | B
- {
- $$ = MODE_B;
- }
- | C
- {
- $$ = MODE_C;
- }
- ;
-
-pathname: pathstring
- {
- /*
- * Problem: this production is used for all pathname
- * processing, but only gives a 550 error reply.
- * This is a valid reply in some cases but not in others.
- */
- if (logged_in && $1 && strncmp((char *) $1, "~", 1) == 0) {
- *(char **)&($$) = *glob((char *) $1);
- if (globerr != 0) {
- reply(550, globerr);
- $$ = 0;
- }
- free((char *) $1);
- } else
- $$ = $1;
- }
- ;
-
-pathstring: STRING
- ;
-
-octal_number: NUMBER
- {
- register int ret, dec, multby, digit;
-
- /*
- * Convert a number that was read as decimal number
- * to what it would be if it had been read as octal.
- */
- dec = $1;
- multby = 1;
- ret = 0;
- while (dec) {
- digit = dec%10;
- if (digit > 7) {
- ret = -1;
- break;
- }
- ret += digit * multby;
- multby *= 8;
- dec /= 10;
- }
- $$ = ret;
- }
- ;
-
-check_login: /* empty */
- {
- if (logged_in)
- $$ = 1;
- else {
- reply(530, "Please login with USER and PASS.");
- $$ = 0;
- }
- }
- ;
-
-%%
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-extern jmp_buf errcatch;
-
-static void upper(char *);
-
-#define CMD 0 /* beginning of command */
-#define ARGS 1 /* expect miscellaneous arguments */
-#define STR1 2 /* expect SP followed by STRING */
-#define STR2 3 /* expect STRING */
-#define OSTR 4 /* optional SP then STRING */
-#define ZSTR1 5 /* SP then optional STRING */
-#define ZSTR2 6 /* optional STRING after SP */
-#define SITECMD 7 /* SITE command */
-#define NSTR 8 /* Number followed by a string */
-
-struct tab cmdtab[] = { /* In order defined in RFC 765 */
- { "USER", USER, STR1, 1, "<sp> username" },
- { "PASS", PASS, ZSTR1, 1, "<sp> password" },
- { "ACCT", ACCT, STR1, 0, "(specify account)" },
- { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
- { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
- { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
- { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
- { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
- { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
- { "STRU", STRU, ARGS, 1, "(specify file structure)" },
- { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
- { "RETR", RETR, STR1, 1, "<sp> file-name" },
- { "STOR", STOR, STR1, 1, "<sp> file-name" },
- { "APPE", APPE, STR1, 1, "<sp> file-name" },
- { "MLFL", MLFL, OSTR, 0, "(mail file)" },
- { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
- { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
- { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
- { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
- { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
- { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
- { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
- { "REST", REST, ARGS, 0, "(restart command)" },
- { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
- { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
- { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
- { "DELE", DELE, STR1, 1, "<sp> file-name" },
- { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
- { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
- { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
- { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
- { "STAT", STAT, OSTR, 1, "[ <sp> path-name ]" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { "NOOP", NOOP, ARGS, 1, "" },
- { "MKD", MKD, STR1, 1, "<sp> path-name" },
- { "XMKD", MKD, STR1, 1, "<sp> path-name" },
- { "RMD", RMD, STR1, 1, "<sp> path-name" },
- { "XRMD", RMD, STR1, 1, "<sp> path-name" },
- { "PWD", PWD, ARGS, 1, "(return current directory)" },
- { "XPWD", PWD, ARGS, 1, "(return current directory)" },
- { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "STOU", STOU, STR1, 1, "<sp> file-name" },
- { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
- { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
- { 0, 0, 0, 0, 0 }
-};
-
-struct tab sitetab[] = {
- { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
- { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
- { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { 0, 0, 0, 0, 0 }
-};
-
-static struct tab *
-lookup(struct tab *p, char *cmd)
-{
-
- for (; p->name != 0; p++)
- if (strcmp(cmd, p->name) == 0)
- return (p);
- return (0);
-}
-
-#include <arpa/telnet.h>
-
-/*
- * get_line - a hacked up version of fgets to ignore TELNET escape codes.
- */
-static char *
-get_line(char *s, int n, FILE *iop)
-{
- register int c;
- register char *cs;
-
- cs = s;
-/* tmpline may contain saved command from urgent mode interruption */
- for (c = 0; tmpline[c] != '\0' && --n > 0; ++c) {
- *cs++ = tmpline[c];
- if (tmpline[c] == '\n') {
- *cs = '\0';
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- tmpline[0] = '\0';
- return(s);
- }
- if (c == 0)
- tmpline[0] = '\0';
- }
- while ((c = getc(iop)) != EOF) {
- c &= 0377;
- if (c == IAC) {
- if ((c = getc(iop)) != EOF) {
- c &= 0377;
- switch (c) {
- case WILL:
- case WONT:
- c = getc(iop);
- printf("%c%c%c", IAC, DONT, 0377&c);
- (void) fflush(stdout);
- continue;
- case DO:
- case DONT:
- c = getc(iop);
- printf("%c%c%c", IAC, WONT, 0377&c);
- (void) fflush(stdout);
- continue;
- case IAC:
- break;
- default:
- continue; /* ignore command */
- }
- }
- }
- *cs++ = c;
- if (--n <= 0 || c == '\n')
- break;
- }
- if (c == EOF && cs == s)
- return (0);
- *cs = '\0';
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- return (s);
-}
-
-static void
-toolong(int sig)
-{
- time_t now;
-
- (void) sig;
- reply(421,
- "Timeout (%d seconds): closing control connection.", timeout);
- (void) time(&now);
- if (logging) {
- syslog(LOG_INFO,
- "User %s timed out after %d seconds at %s",
- (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
- }
- dologout(1);
-}
-
-int
-yylex(void)
-{
- static int cpos, state;
- register char *cp, *cp2;
- register struct tab *p;
- int n;
- char c;
-
- for (;;) {
- switch (state) {
-
- case CMD:
- (void) signal(SIGALRM, toolong);
- (void) alarm((unsigned) timeout);
- if (get_line(cbuf, sizeof(cbuf)-1, stdin) == 0) {
- reply(221, "You could at least say goodbye.");
- dologout(0);
- }
- (void) alarm(0);
-#ifdef SETPROCTITLE
- if (strncasecmp(cbuf, "PASS", 4) != 0)
- setproctitle("%s: %s", proctitle, cbuf);
-#endif /* SETPROCTITLE */
- if ((cp = strchr(cbuf, '\r'))) {
- *cp++ = '\n';
- *cp = '\0';
- }
- if ((cp = strpbrk(cbuf, " \n")))
- cpos = cp - cbuf;
- if (cpos == 0)
- cpos = 4;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- upper(cbuf);
- p = lookup(cmdtab, cbuf);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- nack(p->name);
- longjmp(errcatch,0);
- /* NOTREACHED */
- }
- state = p->state;
- *(const char **)(&yylval) = p->name;
- return (p->token);
- }
- break;
-
- case SITECMD:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- cp = &cbuf[cpos];
- if ((cp2 = strpbrk(cp, " \n")))
- cpos = cp2 - cbuf;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- upper(cp);
- p = lookup(sitetab, cp);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- state = CMD;
- nack(p->name);
- longjmp(errcatch,0);
- /* NOTREACHED */
- }
- state = p->state;
- *(const char **)(&yylval) = p->name;
- return (p->token);
- }
- state = CMD;
- break;
-
- case OSTR:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR1:
- case ZSTR1:
- dostr1:
- if (cbuf[cpos] == ' ') {
- cpos++;
- if (state == OSTR)
- state = STR2;
- else
- ++state;
- return (SP);
- }
- break;
-
- case ZSTR2:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR2:
- cp = &cbuf[cpos];
- n = strlen(cp);
- cpos += n - 1;
- /*
- * Make sure the string is nonempty and \n terminated.
- */
- if (n > 1 && cbuf[cpos] == '\n') {
- cbuf[cpos] = '\0';
- *(char **)&yylval = copy(cp);
- cbuf[cpos] = '\n';
- state = ARGS;
- return (STRING);
- }
- break;
-
- case NSTR:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- if (isdigit(cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit(cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval = atoi(cp);
- cbuf[cpos] = c;
- state = STR1;
- return (NUMBER);
- }
- state = STR1;
- goto dostr1;
-
- case ARGS:
- if (isdigit(cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit(cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval = atoi(cp);
- cbuf[cpos] = c;
- return (NUMBER);
- }
- switch (cbuf[cpos++]) {
-
- case '\n':
- state = CMD;
- return (CRLF);
-
- case ' ':
- return (SP);
-
- case ',':
- return (COMMA);
-
- case 'A':
- case 'a':
- return (A);
-
- case 'B':
- case 'b':
- return (B);
-
- case 'C':
- case 'c':
- return (C);
-
- case 'E':
- case 'e':
- return (E);
-
- case 'F':
- case 'f':
- return (F);
-
- case 'I':
- case 'i':
- return (I);
-
- case 'L':
- case 'l':
- return (L);
-
- case 'N':
- case 'n':
- return (N);
-
- case 'P':
- case 'p':
- return (P);
-
- case 'R':
- case 'r':
- return (R);
-
- case 'S':
- case 's':
- return (S);
-
- case 'T':
- case 't':
- return (T);
-
- }
- break;
-
- default:
- fatal("Unknown state in scanner.");
- }
- yyerror((char *) 0);
- state = CMD;
- longjmp(errcatch,0);
- }
-}
-
-static void
-upper(char *s)
-{
- while (*s != '\0') {
- if (islower(*s))
- *s = toupper(*s);
- s++;
- }
-}
-
-static char *
-copy(const char *s)
-{
- char *p;
-
- p = (char * )malloc(strlen(s) + 1);
- if (p == 0)
- fatal("Ran out of memory.");
- else
- (void) strcpy(p, s);
- return (p);
-}
-
-static void
-help(struct tab *ctab, char *s)
-{
- register struct tab *c;
- register int width, NCMDS;
- const char *help_type;
-
- if (ctab == sitetab)
- help_type = "SITE ";
- else
- help_type = "";
- width = 0, NCMDS = 0;
- for (c = ctab; c->name != 0; c++) {
- int len = strlen(c->name);
-
- if (len > width)
- width = len;
- NCMDS++;
- }
- width = (width + 8) &~ 7;
- if (s == 0) {
- register int i, j, w;
- int columns, lines;
-
- lreply(214, "The following %scommands are recognized %s.",
- help_type, "(* =>'s unimplemented)");
- columns = 76 / width;
- if (columns == 0)
- columns = 1;
- lines = (NCMDS + columns - 1) / columns;
- for (i = 0; i < lines; i++) {
- printf(" ");
- for (j = 0; j < columns; j++) {
- c = ctab + j * lines + i;
- assert(c->name != 0);
- printf("%s%c", c->name,
- c->implemented ? ' ' : '*');
- if (c + lines >= &ctab[NCMDS])
- break;
- w = strlen(c->name) + 1;
- while (w < width) {
- putchar(' ');
- w++;
- }
- }
- printf("\r\n");
- }
- (void) fflush(stdout);
- reply(214, "Direct comments to ftp-bugs@%s.", hostname);
- return;
- }
- upper(s);
- c = lookup(ctab, s);
- if (c == (struct tab *)0) {
- reply(502, "Unknown command %s.", s);
- return;
- }
- if (c->implemented)
- reply(214, "Syntax: %s%s %s", help_type, c->name, c->help);
- else
- reply(214, "%s%-*s\t%s; unimplemented.", help_type, width,
- c->name, c->help);
-}
-
-static void
-sizecmd(char *filename)
-{
- switch (type) {
- case TYPE_L:
- case TYPE_I: {
- struct stat stbuf;
- if (stat(filename, &stbuf) < 0 ||
- (stbuf.st_mode&S_IFMT) != S_IFREG)
- reply(550, "%s: not a plain file.", filename);
- else
-#ifdef HAVE_LONG_LONG
- reply(213, "%llu", (long long) stbuf.st_size);
-#else
- reply(213, "%lu", stbuf.st_size);
-#endif
- break;}
- case TYPE_A: {
- FILE *fin;
- register int c, count;
- struct stat stbuf;
- fin = fopen(filename, "r");
- if (fin == 0) {
- perror_reply(550, filename);
- return;
- }
- if (fstat(fileno(fin), &stbuf) < 0 ||
- (stbuf.st_mode&S_IFMT) != S_IFREG) {
- reply(550, "%s: not a plain file.", filename);
- (void) fclose(fin);
- return;
- }
-
- count = 0;
- while((c=getc(fin)) != EOF) {
- if (c == '\n') /* will get expanded to \r\n */
- count++;
- count++;
- }
- (void) fclose(fin);
-
- reply(213, "%ld", count);
- break;}
- default:
- reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
- }
-}
diff --git a/usr.bin/yacc/tests/grammar.y b/usr.bin/yacc/tests/grammar.y
deleted file mode 100644
index a2f1883..0000000
--- a/usr.bin/yacc/tests/grammar.y
+++ /dev/null
@@ -1,1183 +0,0 @@
-/* $Id: grammar.y,v 1.5 2012/01/15 20:00:59 tom Exp $
- *
- * yacc grammar for C function prototype generator
- * This was derived from the grammar in Appendix A of
- * "The C Programming Language" by Kernighan and Ritchie.
- */
-%expect 1
-%{
-#ifdef YYBISON
-#include <stdlib.h>
-#define YYSTYPE_IS_DECLARED
-#define yyerror yaccError
-#endif
-
-#if defined(YYBISON) || !defined(YYBYACC)
-static void yyerror(const char *s);
-#endif
-%}
-
-%token <text> '(' '*' '&'
- /* identifiers that are not reserved words */
- T_IDENTIFIER T_TYPEDEF_NAME T_DEFINE_NAME
-
- /* storage class */
- T_AUTO T_EXTERN T_REGISTER T_STATIC T_TYPEDEF
- /* This keyword included for compatibility with C++. */
- T_INLINE
- /* This keyword included for compatibility with GCC */
- T_EXTENSION
-
- /* type specifiers */
- T_CHAR T_DOUBLE T_FLOAT T_INT T_VOID
- T_LONG T_SHORT T_SIGNED T_UNSIGNED
- T_ENUM T_STRUCT T_UNION
- /* C9X new types */
- T_Bool T_Complex T_Imaginary
-
- /* type qualifiers */
- T_TYPE_QUALIFIER
-
- /* paired square brackets and everything between them: [ ... ] */
- T_BRACKETS
-
-%token
- /* left brace */
- T_LBRACE
- /* all input to the matching right brace */
- T_MATCHRBRACE
-
- /* three periods */
- T_ELLIPSIS
-
- /* constant expression or paired braces following an equal sign */
- T_INITIALIZER
-
- /* string literal */
- T_STRING_LITERAL
-
- /* asm */
- T_ASM
- /* ( "string literal" ) following asm keyword */
- T_ASMARG
-
- /* va_dcl from <varargs.h> */
- T_VA_DCL
-
-%type <decl_spec> decl_specifiers decl_specifier
-%type <decl_spec> storage_class type_specifier type_qualifier
-%type <decl_spec> struct_or_union_specifier enum_specifier
-%type <decl_list> init_declarator_list
-%type <declarator> init_declarator declarator direct_declarator
-%type <declarator> abs_declarator direct_abs_declarator
-%type <param_list> parameter_type_list parameter_list
-%type <parameter> parameter_declaration
-%type <param_list> opt_identifier_list identifier_list
-%type <text> struct_or_union pointer opt_type_qualifiers type_qualifier_list
- any_id identifier_or_ref
-%type <text> enumeration
-
-%{
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#define OPT_LINTLIBRARY 1
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-/* #include "cproto.h" */
-#define MAX_TEXT_SIZE 1024
-
-/* Prototype styles */
-#if OPT_LINTLIBRARY
-#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
-#define PROTO_LINTLIBRARY -1 /* form lint-library source */
-#endif
-#define PROTO_NONE 0 /* do not output any prototypes */
-#define PROTO_TRADITIONAL 1 /* comment out parameters */
-#define PROTO_ABSTRACT 2 /* comment out parameter names */
-#define PROTO_ANSI 3 /* ANSI C prototype */
-
-typedef int PrototypeStyle;
-
-typedef char boolean;
-
-extern boolean types_out;
-extern PrototypeStyle proto_style;
-
-#define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
-#define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
-#define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
-
-#if OPT_LINTLIBRARY
-#define FUNC_UNKNOWN -1 /* unspecified */
-#else
-#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
-#endif
-#define FUNC_NONE 0 /* not a function definition */
-#define FUNC_TRADITIONAL 1 /* traditional style */
-#define FUNC_ANSI 2 /* ANSI style */
-#define FUNC_BOTH 3 /* both styles */
-
-typedef int FuncDefStyle;
-
-/* Source file text */
-typedef struct text {
- char text[MAX_TEXT_SIZE]; /* source text */
- long begin; /* offset in temporary file */
-} Text;
-
-/* Declaration specifier flags */
-#define DS_NONE 0 /* default */
-#define DS_EXTERN 1 /* contains "extern" specifier */
-#define DS_STATIC 2 /* contains "static" specifier */
-#define DS_CHAR 4 /* contains "char" type specifier */
-#define DS_SHORT 8 /* contains "short" type specifier */
-#define DS_FLOAT 16 /* contains "float" type specifier */
-#define DS_INLINE 32 /* contains "inline" specifier */
-#define DS_JUNK 64 /* we're not interested in this declaration */
-
-/* This structure stores information about a declaration specifier. */
-typedef struct decl_spec {
- unsigned short flags; /* flags defined above */
- char *text; /* source text */
- long begin; /* offset in temporary file */
-} DeclSpec;
-
-/* This is a list of function parameters. */
-typedef struct _ParameterList {
- struct parameter *first; /* pointer to first parameter in list */
- struct parameter *last; /* pointer to last parameter in list */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- char *comment; /* comment at start of parameter list */
-} ParameterList;
-
-/* This structure stores information about a declarator. */
-typedef struct _Declarator {
- char *name; /* name of variable or function */
- char *text; /* source text */
- long begin; /* offset in temporary file */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- FuncDefStyle func_def; /* style of function definition */
- ParameterList params; /* function parameters */
- boolean pointer; /* TRUE if it declares a pointer */
- struct _Declarator *head; /* head function declarator */
- struct _Declarator *func_stack; /* stack of function declarators */
- struct _Declarator *next; /* next declarator in list */
-} Declarator;
-
-/* This structure stores information about a function parameter. */
-typedef struct parameter {
- struct parameter *next; /* next parameter in list */
- DeclSpec decl_spec;
- Declarator *declarator;
- char *comment; /* comment following the parameter */
-} Parameter;
-
-/* This is a list of declarators. */
-typedef struct declarator_list {
- Declarator *first; /* pointer to first declarator in list */
- Declarator *last; /* pointer to last declarator in list */
-} DeclaratorList;
-
-/* #include "symbol.h" */
-typedef struct symbol {
- struct symbol *next; /* next symbol in list */
- char *name; /* name of symbol */
- char *value; /* value of symbol (for defines) */
- short flags; /* symbol attributes */
-} Symbol;
-
-/* parser stack entry type */
-typedef union {
- Text text;
- DeclSpec decl_spec;
- Parameter *parameter;
- ParameterList param_list;
- Declarator *declarator;
- DeclaratorList decl_list;
-} YYSTYPE;
-
-/* The hash table length should be a prime number. */
-#define SYM_MAX_HASH 251
-
-typedef struct symbol_table {
- Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
-} SymbolTable;
-
-extern SymbolTable *new_symbol_table /* Create symbol table */
- (void);
-extern void free_symbol_table /* Destroy symbol table */
- (SymbolTable *s);
-extern Symbol *find_symbol /* Lookup symbol name */
- (SymbolTable *s, const char *n);
-extern Symbol *new_symbol /* Define new symbol */
- (SymbolTable *s, const char *n, const char *v, int f);
-
-/* #include "semantic.h" */
-extern void new_decl_spec (DeclSpec *, const char *, long, int);
-extern void free_decl_spec (DeclSpec *);
-extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
-extern void check_untagged (DeclSpec *);
-extern Declarator *new_declarator (const char *, const char *, long);
-extern void free_declarator (Declarator *);
-extern void new_decl_list (DeclaratorList *, Declarator *);
-extern void free_decl_list (DeclaratorList *);
-extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
-extern Parameter *new_parameter (DeclSpec *, Declarator *);
-extern void free_parameter (Parameter *);
-extern void new_param_list (ParameterList *, Parameter *);
-extern void free_param_list (ParameterList *);
-extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
-extern void new_ident_list (ParameterList *);
-extern void add_ident_list (ParameterList *, ParameterList *, const char *);
-extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
-extern void gen_declarations (DeclSpec *, DeclaratorList *);
-extern void gen_prototype (DeclSpec *, Declarator *);
-extern void gen_func_declarator (Declarator *);
-extern void gen_func_definition (DeclSpec *, Declarator *);
-
-extern void init_parser (void);
-extern void process_file (FILE *infile, char *name);
-extern char *cur_text (void);
-extern char *cur_file_name (void);
-extern char *implied_typedef (void);
-extern void include_file (char *name, int convert);
-extern char *supply_parm (int count);
-extern char *xstrdup (const char *);
-extern int already_declared (char *name);
-extern int is_actual_func (Declarator *d);
-extern int lint_ellipsis (Parameter *p);
-extern int want_typedef (void);
-extern void begin_tracking (void);
-extern void begin_typedef (void);
-extern void copy_typedef (char *s);
-extern void ellipsis_varargs (Declarator *d);
-extern void end_typedef (void);
-extern void flush_varargs (void);
-extern void fmt_library (int code);
-extern void imply_typedef (const char *s);
-extern void indent (FILE *outf);
-extern void put_blankline (FILE *outf);
-extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
-extern void put_char (FILE *outf, int c);
-extern void put_error (void);
-extern void put_newline (FILE *outf);
-extern void put_padded (FILE *outf, const char *s);
-extern void put_string (FILE *outf, const char *s);
-extern void track_in (void);
-
-extern boolean file_comments;
-extern FuncDefStyle func_style;
-extern char base_file[];
-
-extern int yylex (void);
-
-/* declaration specifier attributes for the typedef statement currently being
- * scanned
- */
-static int cur_decl_spec_flags;
-
-/* pointer to parameter list for the current function definition */
-static ParameterList *func_params;
-
-/* A parser semantic action sets this pointer to the current declarator in
- * a function parameter declaration in order to catch any comments following
- * the parameter declaration on the same line. If the lexer scans a comment
- * and <cur_declarator> is not NULL, then the comment is attached to the
- * declarator. To ignore subsequent comments, the lexer sets this to NULL
- * after scanning a comment or end of line.
- */
-static Declarator *cur_declarator;
-
-/* temporary string buffer */
-static char buf[MAX_TEXT_SIZE];
-
-/* table of typedef names */
-static SymbolTable *typedef_names;
-
-/* table of define names */
-static SymbolTable *define_names;
-
-/* table of type qualifiers */
-static SymbolTable *type_qualifiers;
-
-/* information about the current input file */
-typedef struct {
- char *base_name; /* base input file name */
- char *file_name; /* current file name */
- FILE *file; /* input file */
- unsigned line_num; /* current line number in input file */
- FILE *tmp_file; /* temporary file */
- long begin_comment; /* tmp file offset after last written ) or ; */
- long end_comment; /* tmp file offset after last comment */
- boolean convert; /* if TRUE, convert function definitions */
- boolean changed; /* TRUE if conversion done in this file */
-} IncludeStack;
-
-static IncludeStack *cur_file; /* current input file */
-
-/* #include "yyerror.c" */
-
-static int haveAnsiParam (void);
-
-
-/* Flags to enable us to find if a procedure returns a value.
- */
-static int return_val; /* nonzero on BRACES iff return-expression found */
-
-static const char *
-dft_decl_spec (void)
-{
- return (lintLibrary() && !return_val) ? "void" : "int";
-}
-
-static int
-haveAnsiParam (void)
-{
- Parameter *p;
- if (func_params != 0) {
- for (p = func_params->first; p != 0; p = p->next) {
- if (p->declarator->func_def == FUNC_ANSI) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-%}
-%%
-
-program
- : /* empty */
- | translation_unit
- ;
-
-translation_unit
- : external_declaration
- | translation_unit external_declaration
- ;
-
-external_declaration
- : declaration
- | function_definition
- | ';'
- | linkage_specification
- | T_ASM T_ASMARG ';'
- | error T_MATCHRBRACE
- {
- yyerrok;
- }
- | error ';'
- {
- yyerrok;
- }
- ;
-
-braces
- : T_LBRACE T_MATCHRBRACE
- ;
-
-linkage_specification
- : T_EXTERN T_STRING_LITERAL braces
- {
- /* Provide an empty action here so bison will not complain about
- * incompatible types in the default action it normally would
- * have generated.
- */
- }
- | T_EXTERN T_STRING_LITERAL declaration
- {
- /* empty */
- }
- ;
-
-declaration
- : decl_specifiers ';'
- {
-#if OPT_LINTLIBRARY
- if (types_out && want_typedef()) {
- gen_declarations(&$1, (DeclaratorList *)0);
- flush_varargs();
- }
-#endif
- free_decl_spec(&$1);
- end_typedef();
- }
- | decl_specifiers init_declarator_list ';'
- {
- if (func_params != NULL) {
- set_param_types(func_params, &$1, &$2);
- } else {
- gen_declarations(&$1, &$2);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_list(&$2);
- }
- free_decl_spec(&$1);
- end_typedef();
- }
- | any_typedef decl_specifiers
- {
- cur_decl_spec_flags = $2.flags;
- free_decl_spec(&$2);
- }
- opt_declarator_list ';'
- {
- end_typedef();
- }
- ;
-
-any_typedef
- : T_EXTENSION T_TYPEDEF
- {
- begin_typedef();
- }
- | T_TYPEDEF
- {
- begin_typedef();
- }
- ;
-
-opt_declarator_list
- : /* empty */
- | declarator_list
- ;
-
-declarator_list
- : declarator
- {
- int flags = cur_decl_spec_flags;
-
- /* If the typedef is a pointer type, then reset the short type
- * flags so it does not get promoted.
- */
- if (strcmp($1->text, $1->name) != 0)
- flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- new_symbol(typedef_names, $1->name, NULL, flags);
- free_declarator($1);
- }
- | declarator_list ',' declarator
- {
- int flags = cur_decl_spec_flags;
-
- if (strcmp($3->text, $3->name) != 0)
- flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- new_symbol(typedef_names, $3->name, NULL, flags);
- free_declarator($3);
- }
- ;
-
-function_definition
- : decl_specifiers declarator
- {
- check_untagged(&$1);
- if ($2->func_def == FUNC_NONE) {
- yyerror("syntax error");
- YYERROR;
- }
- func_params = &($2->head->params);
- func_params->begin_comment = cur_file->begin_comment;
- func_params->end_comment = cur_file->end_comment;
- }
- opt_declaration_list T_LBRACE
- {
- /* If we're converting to K&R and we've got a nominally K&R
- * function which has a parameter which is ANSI (i.e., a prototyped
- * function pointer), then we must override the deciphered value of
- * 'func_def' so that the parameter will be converted.
- */
- if (func_style == FUNC_TRADITIONAL
- && haveAnsiParam()
- && $2->head->func_def == func_style) {
- $2->head->func_def = FUNC_BOTH;
- }
-
- func_params = NULL;
-
- if (cur_file->convert)
- gen_func_definition(&$1, $2);
- gen_prototype(&$1, $2);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_spec(&$1);
- free_declarator($2);
- }
- T_MATCHRBRACE
- | declarator
- {
- if ($1->func_def == FUNC_NONE) {
- yyerror("syntax error");
- YYERROR;
- }
- func_params = &($1->head->params);
- func_params->begin_comment = cur_file->begin_comment;
- func_params->end_comment = cur_file->end_comment;
- }
- opt_declaration_list T_LBRACE T_MATCHRBRACE
- {
- DeclSpec decl_spec;
-
- func_params = NULL;
-
- new_decl_spec(&decl_spec, dft_decl_spec(), $1->begin, DS_NONE);
- if (cur_file->convert)
- gen_func_definition(&decl_spec, $1);
- gen_prototype(&decl_spec, $1);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_spec(&decl_spec);
- free_declarator($1);
- }
- ;
-
-opt_declaration_list
- : /* empty */
- | T_VA_DCL
- | declaration_list
- ;
-
-declaration_list
- : declaration
- | declaration_list declaration
- ;
-
-decl_specifiers
- : decl_specifier
- | decl_specifiers decl_specifier
- {
- join_decl_specs(&$$, &$1, &$2);
- free($1.text);
- free($2.text);
- }
- ;
-
-decl_specifier
- : storage_class
- | type_specifier
- | type_qualifier
- ;
-
-storage_class
- : T_AUTO
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_EXTERN
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
- }
- | T_REGISTER
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_STATIC
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_STATIC);
- }
- | T_INLINE
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_INLINE);
- }
- | T_EXTENSION
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_JUNK);
- }
- ;
-
-type_specifier
- : T_CHAR
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR);
- }
- | T_DOUBLE
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_FLOAT
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_FLOAT);
- }
- | T_INT
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_LONG
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_SHORT
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_SHORT);
- }
- | T_SIGNED
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_UNSIGNED
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_VOID
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_Bool
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR);
- }
- | T_Complex
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_Imaginary
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_TYPEDEF_NAME
- {
- Symbol *s;
- s = find_symbol(typedef_names, $1.text);
- if (s != NULL)
- new_decl_spec(&$$, $1.text, $1.begin, s->flags);
- }
- | struct_or_union_specifier
- | enum_specifier
- ;
-
-type_qualifier
- : T_TYPE_QUALIFIER
- {
- new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
- }
- | T_DEFINE_NAME
- {
- /* This rule allows the <pointer> nonterminal to scan #define
- * names as if they were type modifiers.
- */
- Symbol *s;
- s = find_symbol(define_names, $1.text);
- if (s != NULL)
- new_decl_spec(&$$, $1.text, $1.begin, s->flags);
- }
- ;
-
-struct_or_union_specifier
- : struct_or_union any_id braces
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s %s", $1.text, $2.text);
- new_decl_spec(&$$, s, $1.begin, DS_NONE);
- }
- | struct_or_union braces
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s {}", $1.text);
- new_decl_spec(&$$, s, $1.begin, DS_NONE);
- }
- | struct_or_union any_id
- {
- (void)sprintf(buf, "%s %s", $1.text, $2.text);
- new_decl_spec(&$$, buf, $1.begin, DS_NONE);
- }
- ;
-
-struct_or_union
- : T_STRUCT
- {
- imply_typedef($$.text);
- }
- | T_UNION
- {
- imply_typedef($$.text);
- }
- ;
-
-init_declarator_list
- : init_declarator
- {
- new_decl_list(&$$, $1);
- }
- | init_declarator_list ',' init_declarator
- {
- add_decl_list(&$$, &$1, $3);
- }
- ;
-
-init_declarator
- : declarator
- {
- if ($1->func_def != FUNC_NONE && func_params == NULL &&
- func_style == FUNC_TRADITIONAL && cur_file->convert) {
- gen_func_declarator($1);
- fputs(cur_text(), cur_file->tmp_file);
- }
- cur_declarator = $$;
- }
- | declarator '='
- {
- if ($1->func_def != FUNC_NONE && func_params == NULL &&
- func_style == FUNC_TRADITIONAL && cur_file->convert) {
- gen_func_declarator($1);
- fputs(" =", cur_file->tmp_file);
- }
- }
- T_INITIALIZER
- ;
-
-enum_specifier
- : enumeration any_id braces
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "enum %s", $2.text);
- new_decl_spec(&$$, s, $1.begin, DS_NONE);
- }
- | enumeration braces
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s {}", $1.text);
- new_decl_spec(&$$, s, $1.begin, DS_NONE);
- }
- | enumeration any_id
- {
- (void)sprintf(buf, "enum %s", $2.text);
- new_decl_spec(&$$, buf, $1.begin, DS_NONE);
- }
- ;
-
-enumeration
- : T_ENUM
- {
- imply_typedef("enum");
- $$ = $1;
- }
- ;
-
-any_id
- : T_IDENTIFIER
- | T_TYPEDEF_NAME
- ;
-
-declarator
- : pointer direct_declarator
- {
- $$ = $2;
- (void)sprintf(buf, "%s%s", $1.text, $$->text);
- free($$->text);
- $$->text = xstrdup(buf);
- $$->begin = $1.begin;
- $$->pointer = TRUE;
- }
- | direct_declarator
- ;
-
-direct_declarator
- : identifier_or_ref
- {
- $$ = new_declarator($1.text, $1.text, $1.begin);
- }
- | '(' declarator ')'
- {
- $$ = $2;
- (void)sprintf(buf, "(%s)", $$->text);
- free($$->text);
- $$->text = xstrdup(buf);
- $$->begin = $1.begin;
- }
- | direct_declarator T_BRACKETS
- {
- $$ = $1;
- (void)sprintf(buf, "%s%s", $$->text, $2.text);
- free($$->text);
- $$->text = xstrdup(buf);
- }
- | direct_declarator '(' parameter_type_list ')'
- {
- $$ = new_declarator("%s()", $1->name, $1->begin);
- $$->params = $3;
- $$->func_stack = $1;
- $$->head = ($1->func_stack == NULL) ? $$ : $1->head;
- $$->func_def = FUNC_ANSI;
- }
- | direct_declarator '(' opt_identifier_list ')'
- {
- $$ = new_declarator("%s()", $1->name, $1->begin);
- $$->params = $3;
- $$->func_stack = $1;
- $$->head = ($1->func_stack == NULL) ? $$ : $1->head;
- $$->func_def = FUNC_TRADITIONAL;
- }
- ;
-
-pointer
- : '*' opt_type_qualifiers
- {
- (void)sprintf($$.text, "*%s", $2.text);
- $$.begin = $1.begin;
- }
- | '*' opt_type_qualifiers pointer
- {
- (void)sprintf($$.text, "*%s%s", $2.text, $3.text);
- $$.begin = $1.begin;
- }
- ;
-
-opt_type_qualifiers
- : /* empty */
- {
- strcpy($$.text, "");
- $$.begin = 0L;
- }
- | type_qualifier_list
- ;
-
-type_qualifier_list
- : type_qualifier
- {
- (void)sprintf($$.text, "%s ", $1.text);
- $$.begin = $1.begin;
- free($1.text);
- }
- | type_qualifier_list type_qualifier
- {
- (void)sprintf($$.text, "%s%s ", $1.text, $2.text);
- $$.begin = $1.begin;
- free($2.text);
- }
- ;
-
-parameter_type_list
- : parameter_list
- | parameter_list ',' T_ELLIPSIS
- {
- add_ident_list(&$$, &$1, "...");
- }
- ;
-
-parameter_list
- : parameter_declaration
- {
- new_param_list(&$$, $1);
- }
- | parameter_list ',' parameter_declaration
- {
- add_param_list(&$$, &$1, $3);
- }
- ;
-
-parameter_declaration
- : decl_specifiers declarator
- {
- check_untagged(&$1);
- $$ = new_parameter(&$1, $2);
- }
- | decl_specifiers abs_declarator
- {
- check_untagged(&$1);
- $$ = new_parameter(&$1, $2);
- }
- | decl_specifiers
- {
- check_untagged(&$1);
- $$ = new_parameter(&$1, (Declarator *)0);
- }
- ;
-
-opt_identifier_list
- : /* empty */
- {
- new_ident_list(&$$);
- }
- | identifier_list
- ;
-
-identifier_list
- : any_id
- {
- new_ident_list(&$$);
- add_ident_list(&$$, &$$, $1.text);
- }
- | identifier_list ',' any_id
- {
- add_ident_list(&$$, &$1, $3.text);
- }
- ;
-
-identifier_or_ref
- : any_id
- {
- $$ = $1;
- }
- | '&' any_id
- {
-#if OPT_LINTLIBRARY
- if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
- $$ = $2;
- } else
-#endif
- (void)sprintf($$.text, "&%s", $2.text);
- $$.begin = $1.begin;
- }
- ;
-
-abs_declarator
- : pointer
- {
- $$ = new_declarator($1.text, "", $1.begin);
- }
- | pointer direct_abs_declarator
- {
- $$ = $2;
- (void)sprintf(buf, "%s%s", $1.text, $$->text);
- free($$->text);
- $$->text = xstrdup(buf);
- $$->begin = $1.begin;
- }
- | direct_abs_declarator
- ;
-
-direct_abs_declarator
- : '(' abs_declarator ')'
- {
- $$ = $2;
- (void)sprintf(buf, "(%s)", $$->text);
- free($$->text);
- $$->text = xstrdup(buf);
- $$->begin = $1.begin;
- }
- | direct_abs_declarator T_BRACKETS
- {
- $$ = $1;
- (void)sprintf(buf, "%s%s", $$->text, $2.text);
- free($$->text);
- $$->text = xstrdup(buf);
- }
- | T_BRACKETS
- {
- $$ = new_declarator($1.text, "", $1.begin);
- }
- | direct_abs_declarator '(' parameter_type_list ')'
- {
- $$ = new_declarator("%s()", "", $1->begin);
- $$->params = $3;
- $$->func_stack = $1;
- $$->head = ($1->func_stack == NULL) ? $$ : $1->head;
- $$->func_def = FUNC_ANSI;
- }
- | direct_abs_declarator '(' ')'
- {
- $$ = new_declarator("%s()", "", $1->begin);
- $$->func_stack = $1;
- $$->head = ($1->func_stack == NULL) ? $$ : $1->head;
- $$->func_def = FUNC_ANSI;
- }
- | '(' parameter_type_list ')'
- {
- Declarator *d;
-
- d = new_declarator("", "", $1.begin);
- $$ = new_declarator("%s()", "", $1.begin);
- $$->params = $2;
- $$->func_stack = d;
- $$->head = $$;
- $$->func_def = FUNC_ANSI;
- }
- | '(' ')'
- {
- Declarator *d;
-
- d = new_declarator("", "", $1.begin);
- $$ = new_declarator("%s()", "", $1.begin);
- $$->func_stack = d;
- $$->head = $$;
- $$->func_def = FUNC_ANSI;
- }
- ;
-
-%%
-
-/* lex.yy.c */
-#define BEGIN yy_start = 1 + 2 *
-
-#define CPP1 1
-#define INIT1 2
-#define INIT2 3
-#define CURLY 4
-#define LEXYACC 5
-#define ASM 6
-#define CPP_INLINE 7
-
-extern char *yytext;
-extern FILE *yyin, *yyout;
-
-static int curly; /* number of curly brace nesting levels */
-static int ly_count; /* number of occurrences of %% */
-static int inc_depth; /* include nesting level */
-static SymbolTable *included_files; /* files already included */
-static int yy_start = 0; /* start state number */
-
-#define grammar_error(s) yaccError(s)
-
-static void
-yaccError (const char *msg)
-{
- func_params = NULL;
- put_error(); /* tell what line we're on, and what file */
- fprintf(stderr, "%s at token '%s'\n", msg, yytext);
-}
-
-/* Initialize the table of type qualifier keywords recognized by the lexical
- * analyzer.
- */
-void
-init_parser (void)
-{
- static const char *keywords[] = {
- "const",
- "restrict",
- "volatile",
- "interrupt",
-#ifdef vms
- "noshare",
- "readonly",
-#endif
-#if defined(MSDOS) || defined(OS2)
- "__cdecl",
- "__export",
- "__far",
- "__fastcall",
- "__fortran",
- "__huge",
- "__inline",
- "__interrupt",
- "__loadds",
- "__near",
- "__pascal",
- "__saveregs",
- "__segment",
- "__stdcall",
- "__syscall",
- "_cdecl",
- "_cs",
- "_ds",
- "_es",
- "_export",
- "_far",
- "_fastcall",
- "_fortran",
- "_huge",
- "_interrupt",
- "_loadds",
- "_near",
- "_pascal",
- "_saveregs",
- "_seg",
- "_segment",
- "_ss",
- "cdecl",
- "far",
- "huge",
- "near",
- "pascal",
-#ifdef OS2
- "__far16",
-#endif
-#endif
-#ifdef __GNUC__
- /* gcc aliases */
- "__builtin_va_arg",
- "__builtin_va_list",
- "__const",
- "__const__",
- "__inline",
- "__inline__",
- "__restrict",
- "__restrict__",
- "__volatile",
- "__volatile__",
-#endif
- };
- unsigned i;
-
- /* Initialize type qualifier table. */
- type_qualifiers = new_symbol_table();
- for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
- new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
- }
-}
-
-/* Process the C source file. Write function prototypes to the standard
- * output. Convert function definitions and write the converted source
- * code to a temporary file.
- */
-void
-process_file (FILE *infile, char *name)
-{
- char *s;
-
- if (strlen(name) > 2) {
- s = name + strlen(name) - 2;
- if (*s == '.') {
- ++s;
- if (*s == 'l' || *s == 'y')
- BEGIN LEXYACC;
-#if defined(MSDOS) || defined(OS2)
- if (*s == 'L' || *s == 'Y')
- BEGIN LEXYACC;
-#endif
- }
- }
-
- included_files = new_symbol_table();
- typedef_names = new_symbol_table();
- define_names = new_symbol_table();
- inc_depth = -1;
- curly = 0;
- ly_count = 0;
- func_params = NULL;
- yyin = infile;
- include_file(strcpy(base_file, name), func_style != FUNC_NONE);
- if (file_comments) {
-#if OPT_LINTLIBRARY
- if (lintLibrary()) {
- put_blankline(stdout);
- begin_tracking();
- }
-#endif
- put_string(stdout, "/* ");
- put_string(stdout, cur_file_name());
- put_string(stdout, " */\n");
- }
- yyparse();
- free_symbol_table(define_names);
- free_symbol_table(typedef_names);
- free_symbol_table(included_files);
-}
-
-#ifdef NO_LEAKS
-void
-free_parser(void)
-{
- free_symbol_table (type_qualifiers);
-#ifdef FLEX_SCANNER
- if (yy_current_buffer != 0)
- yy_delete_buffer(yy_current_buffer);
-#endif
-}
-#endif
diff --git a/usr.bin/yacc/tests/legacy_test.sh b/usr.bin/yacc/tests/legacy_test.sh
deleted file mode 100644
index 1b6b806..0000000
--- a/usr.bin/yacc/tests/legacy_test.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-
-SRCDIR="$(dirname "${0}")"; export SRCDIR
-
-m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/yacc/tests/pure_calc.y b/usr.bin/yacc/tests/pure_calc.y
deleted file mode 100644
index 3cd0433..0000000
--- a/usr.bin/yacc/tests/pure_calc.y
+++ /dev/null
@@ -1,116 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM &yylval
-#define YYLEX_DECL() yylex(YYSTYPE *yylval)
-#define YYERROR_DECL() yyerror(const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-%}
-
-%start list
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr '+' expr
- { $$ = $1 + $3; }
- | expr '-' expr
- { $$ = $1 - $3; }
- | expr '*' expr
- { $$ = $1 * $3; }
- | expr '/' expr
- { $$ = $1 / $3; }
- | expr '%' expr
- { $$ = $1 % $3; }
- | expr '&' expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | '-' expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-#ifdef YYBYACC
-static int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-YYERROR_DECL()
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-YYLEX_DECL()
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- *yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- *yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/pure_error.y b/usr.bin/yacc/tests/pure_error.y
deleted file mode 100644
index fe7a3c3..0000000
--- a/usr.bin/yacc/tests/pure_error.y
+++ /dev/null
@@ -1,41 +0,0 @@
-%{
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM &yylval
-#define YYLEX_DECL() yylex(YYSTYPE *yylval)
-#define YYERROR_DECL() yyerror(const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-%}
-
-%%
-S: error
-%%
-
-#include <stdio.h>
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(YYSTYPE *value)
-{
- return value ? 0 : -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
diff --git a/usr.bin/yacc/tests/quote_calc.y b/usr.bin/yacc/tests/quote_calc.y
deleted file mode 100644
index 9304dd8..0000000
--- a/usr.bin/yacc/tests/quote_calc.y
+++ /dev/null
@@ -1,112 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-%}
-
-%start list
-
-%token OP_ADD "ADD"
-%token OP_SUB "SUB"
-%token OP_MUL "MUL"
-%token OP_DIV "DIV"
-%token OP_MOD "MOD"
-%token OP_AND "AND"
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr OP_ADD expr
- { $$ = $1 + $3; }
- | expr OP_SUB expr
- { $$ = $1 - $3; }
- | expr OP_MUL expr
- { $$ = $1 * $3; }
- | expr OP_DIV expr
- { $$ = $1 / $3; }
- | expr OP_MOD expr
- { $$ = $1 % $3; }
- | expr OP_AND expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | OP_SUB expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/quote_calc2.y b/usr.bin/yacc/tests/quote_calc2.y
deleted file mode 100644
index ab72a28..0000000
--- a/usr.bin/yacc/tests/quote_calc2.y
+++ /dev/null
@@ -1,112 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-%}
-
-%start list
-
-%token OP_ADD "ADD"
-%token OP_SUB "SUB"
-%token OP_MUL "MUL"
-%token OP_DIV "DIV"
-%token OP_MOD "MOD"
-%token OP_AND "AND"
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr "ADD" expr
- { $$ = $1 + $3; }
- | expr "SUB" expr
- { $$ = $1 - $3; }
- | expr "MUL" expr
- { $$ = $1 * $3; }
- | expr "DIV" expr
- { $$ = $1 / $3; }
- | expr "MOD" expr
- { $$ = $1 % $3; }
- | expr "AND" expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | "SUB" expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/quote_calc3.y b/usr.bin/yacc/tests/quote_calc3.y
deleted file mode 100644
index 5feeb4a..0000000
--- a/usr.bin/yacc/tests/quote_calc3.y
+++ /dev/null
@@ -1,112 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-%}
-
-%start list
-
-%token OP_ADD "ADD-operator"
-%token OP_SUB "SUB-operator"
-%token OP_MUL "MUL-operator"
-%token OP_DIV "DIV-operator"
-%token OP_MOD "MOD-operator"
-%token OP_AND "AND-operator"
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr OP_ADD expr
- { $$ = $1 + $3; }
- | expr OP_SUB expr
- { $$ = $1 - $3; }
- | expr OP_MUL expr
- { $$ = $1 * $3; }
- | expr OP_DIV expr
- { $$ = $1 / $3; }
- | expr OP_MOD expr
- { $$ = $1 % $3; }
- | expr OP_AND expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | OP_SUB expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/quote_calc4.y b/usr.bin/yacc/tests/quote_calc4.y
deleted file mode 100644
index 34b790e..0000000
--- a/usr.bin/yacc/tests/quote_calc4.y
+++ /dev/null
@@ -1,112 +0,0 @@
-%{
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-%}
-
-%start list
-
-%token OP_ADD "ADD-operator"
-%token OP_SUB "SUB-operator"
-%token OP_MUL "MUL-operator"
-%token OP_DIV "DIV-operator"
-%token OP_MOD "MOD-operator"
-%token OP_AND "AND-operator"
-
-%token DIGIT LETTER
-
-%left '|'
-%left '&'
-%left '+' '-'
-%left '*' '/' '%'
-%left UMINUS /* supplies precedence for unary minus */
-
-%% /* beginning of rules section */
-
-list : /* empty */
- | list stat '\n'
- | list error '\n'
- { yyerrok ; }
- ;
-
-stat : expr
- { printf("%d\n",$1);}
- | LETTER '=' expr
- { regs[$1] = $3; }
- ;
-
-expr : '(' expr ')'
- { $$ = $2; }
- | expr "ADD-operator" expr
- { $$ = $1 + $3; }
- | expr "SUB-operator" expr
- { $$ = $1 - $3; }
- | expr "MUL-operator" expr
- { $$ = $1 * $3; }
- | expr "DIV-operator" expr
- { $$ = $1 / $3; }
- | expr "MOD-operator" expr
- { $$ = $1 % $3; }
- | expr "AND-operator" expr
- { $$ = $1 & $3; }
- | expr '|' expr
- { $$ = $1 | $3; }
- | "SUB-operator" expr %prec UMINUS
- { $$ = - $2; }
- | LETTER
- { $$ = regs[$1]; }
- | number
- ;
-
-number: DIGIT
- { $$ = $1; base = ($1==0) ? 8 : 10; }
- | number DIGIT
- { $$ = base * $1 + $2; }
- ;
-
-%% /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
diff --git a/usr.bin/yacc/tests/regress.00.out b/usr.bin/yacc/tests/regress.00.out
deleted file mode 100644
index 39a8ca2..0000000
--- a/usr.bin/yacc/tests/regress.00.out
+++ /dev/null
@@ -1,386 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0,
-};
-static const short yylen[] = { 2,
- 0,
-};
-static const short yydefred[] = { 1,
- 0,
-};
-static const short yydgoto[] = { 1,
-};
-static const short yysindex[] = { 0,
- 0,
-};
-static const short yyrindex[] = { 0,
- 0,
-};
-static const short yygindex[] = { 0,
-};
-#define YYTABLESIZE 0
-static const short yytable[] = { 0,
-};
-static const short yycheck[] = { -1,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 0
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : rule",
-"rule :",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.01.out b/usr.bin/yacc/tests/regress.01.out
deleted file mode 100644
index 8187502..0000000
--- a/usr.bin/yacc/tests/regress.01.out
+++ /dev/null
@@ -1,589 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "calc.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-extern int yylex(void);
-static void yyerror(const char *s);
-
-#line 29 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define DIGIT 257
-#define LETTER 258
-#define UMINUS 259
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
- 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
- 10, 11,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
- -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
- -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
- 0, 65, 0,
-};
-#define YYTABLESIZE 220
-static const short yytable[] = { 6,
- 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
- 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
- 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
- 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
- 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
- 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
- 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
- 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
- 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
- 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
- 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
- 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
- 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
-};
-static const short yycheck[] = { 40,
- 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
- 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
- -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
- -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
- -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
- 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
- -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
- 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
- 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
- -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
- -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
- -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 259
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr '+' expr",
-"expr : expr '-' expr",
-"expr : expr '*' expr",
-"expr : expr '/' expr",
-"expr : expr '%' expr",
-"expr : expr '&' expr",
-"expr : expr '|' expr",
-"expr : '-' expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 66 "calc.y"
- /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 267 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 28 "calc.y"
- { yyerrok ; }
-break;
-case 4:
-#line 32 "calc.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 34 "calc.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 38 "calc.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 40 "calc.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 42 "calc.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 44 "calc.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 46 "calc.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 48 "calc.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 50 "calc.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 52 "calc.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 54 "calc.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 56 "calc.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 61 "calc.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 63 "calc.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 529 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.02.out b/usr.bin/yacc/tests/regress.02.out
deleted file mode 100644
index 30de536..0000000
--- a/usr.bin/yacc/tests/regress.02.out
+++ /dev/null
@@ -1,831 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "calc1.y"
-
-/* http://dinosaur.compilertools.net/yacc/index.html */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-
-typedef struct interval
-{
- double lo, hi;
-}
-INTERVAL;
-
-INTERVAL vmul(double, double, INTERVAL);
-INTERVAL vdiv(double, double, INTERVAL);
-
-extern int yylex(void);
-static void yyerror(const char *s);
-
-int dcheck(INTERVAL);
-
-double dreg[26];
-INTERVAL vreg[26];
-
-#line 31 "calc1.y"
-#ifdef YYSTYPE
-#undef YYSTYPE_IS_DECLARED
-#define YYSTYPE_IS_DECLARED 1
-#endif
-#ifndef YYSTYPE_IS_DECLARED
-#define YYSTYPE_IS_DECLARED 1
-typedef union
-{
- int ival;
- double dval;
- INTERVAL vval;
-} YYSTYPE;
-#endif /* !YYSTYPE_IS_DECLARED */
-#line 59 "/dev/stdout"
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define DREG 257
-#define VREG 258
-#define CONST 259
-#define UMINUS 260
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
-};
-static const short yylen[] = { 2,
- 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
- 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 3,
-};
-static const short yydefred[] = { 0,
- 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
- 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
- 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
- 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
- 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
- 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
- 13, 17,
-};
-static const short yydgoto[] = { 7,
- 32, 9, 0,
-};
-static const short yysindex[] = { -40,
- -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
- -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
- -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
- 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
- 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
- -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
- 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
- 4, 124, 0,
-};
-#define YYTABLESIZE 225
-static const short yytable[] = { 6,
- 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
- 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
- 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
- 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
- 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
- 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
- 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
- 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
- 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
- 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
- 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
- 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
- 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
- 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
- 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
- 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
- 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
- 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
- 14, 4, 13, 0, 4,
-};
-static const short yycheck[] = { 40,
- 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
- 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
- -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
- 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
- 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
- -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
- 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
- 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
- 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
- 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
- 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
- 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
- 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
- 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
- -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
- 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
- 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
- -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
- 258, 259, 257, -1, 259,
-};
-#define YYFINAL 7
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 260
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,
-0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,"DREG","VREG","CONST","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : line",
-"lines :",
-"lines : lines line",
-"line : dexp '\\n'",
-"line : vexp '\\n'",
-"line : DREG '=' dexp '\\n'",
-"line : VREG '=' vexp '\\n'",
-"line : error '\\n'",
-"dexp : CONST",
-"dexp : DREG",
-"dexp : dexp '+' dexp",
-"dexp : dexp '-' dexp",
-"dexp : dexp '*' dexp",
-"dexp : dexp '/' dexp",
-"dexp : '-' dexp",
-"dexp : '(' dexp ')'",
-"vexp : dexp",
-"vexp : '(' dexp ',' dexp ')'",
-"vexp : VREG",
-"vexp : vexp '+' vexp",
-"vexp : dexp '+' vexp",
-"vexp : vexp '-' vexp",
-"vexp : dexp '-' vexp",
-"vexp : vexp '*' vexp",
-"vexp : dexp '*' vexp",
-"vexp : vexp '/' vexp",
-"vexp : dexp '/' vexp",
-"vexp : '-' vexp",
-"vexp : '(' vexp ')'",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 176 "calc1.y"
- /* beginning of subroutines section */
-
-#define BSZ 50 /* buffer size for floating point numbers */
-
- /* lexical analysis */
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- int c;
-
- while ((c = getchar()) == ' ')
- { /* skip over blanks */
- }
-
- if (isupper(c))
- {
- yylval.ival = c - 'A';
- return (VREG);
- }
- if (islower(c))
- {
- yylval.ival = c - 'a';
- return (DREG);
- }
-
- if (isdigit(c) || c == '.')
- {
- /* gobble up digits, points, exponents */
- char buf[BSZ + 1], *cp = buf;
- int dot = 0, expr = 0;
-
- for (; (cp - buf) < BSZ; ++cp, c = getchar())
- {
-
- *cp = c;
- if (isdigit(c))
- continue;
- if (c == '.')
- {
- if (dot++ || expr)
- return ('.'); /* will cause syntax error */
- continue;
- }
-
- if (c == 'e')
- {
- if (expr++)
- return ('e'); /* will cause syntax error */
- continue;
- }
-
- /* end of number */
- break;
- }
- *cp = '\0';
-
- if ((cp - buf) >= BSZ)
- printf("constant too long: truncated\n");
- else
- ungetc(c, stdin); /* push back last char read */
- yylval.dval = atof(buf);
- return (CONST);
- }
- return (c);
-}
-
-static INTERVAL
-hilo(double a, double b, double c, double d)
-{
- /* returns the smallest interval containing a, b, c, and d */
- /* used by *, / routines */
- INTERVAL v;
-
- if (a > b)
- {
- v.hi = a;
- v.lo = b;
- }
- else
- {
- v.hi = b;
- v.lo = a;
- }
-
- if (c > d)
- {
- if (c > v.hi)
- v.hi = c;
- if (d < v.lo)
- v.lo = d;
- }
- else
- {
- if (d > v.hi)
- v.hi = d;
- if (c < v.lo)
- v.lo = c;
- }
- return (v);
-}
-
-INTERVAL
-vmul(double a, double b, INTERVAL v)
-{
- return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
-}
-
-int
-dcheck(INTERVAL v)
-{
- if (v.hi >= 0. && v.lo <= 0.)
- {
- printf("divisor interval contains 0.\n");
- return (1);
- }
- return (0);
-}
-
-INTERVAL
-vdiv(double a, double b, INTERVAL v)
-{
- return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
-}
-#line 406 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 57 "calc1.y"
- {
- (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
- }
-break;
-case 4:
-#line 61 "calc1.y"
- {
- (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
- }
-break;
-case 5:
-#line 65 "calc1.y"
- {
- dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
- }
-break;
-case 6:
-#line 69 "calc1.y"
- {
- vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
- }
-break;
-case 7:
-#line 73 "calc1.y"
- {
- yyerrok;
- }
-break;
-case 9:
-#line 80 "calc1.y"
- {
- yyval.dval = dreg[yystack.l_mark[0].ival];
- }
-break;
-case 10:
-#line 84 "calc1.y"
- {
- yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
- }
-break;
-case 11:
-#line 88 "calc1.y"
- {
- yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
- }
-break;
-case 12:
-#line 92 "calc1.y"
- {
- yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
- }
-break;
-case 13:
-#line 96 "calc1.y"
- {
- yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
- }
-break;
-case 14:
-#line 100 "calc1.y"
- {
- yyval.dval = -yystack.l_mark[0].dval;
- }
-break;
-case 15:
-#line 104 "calc1.y"
- {
- yyval.dval = yystack.l_mark[-1].dval;
- }
-break;
-case 16:
-#line 110 "calc1.y"
- {
- yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
- }
-break;
-case 17:
-#line 114 "calc1.y"
- {
- yyval.vval.lo = yystack.l_mark[-3].dval;
- yyval.vval.hi = yystack.l_mark[-1].dval;
- if ( yyval.vval.lo > yyval.vval.hi )
- {
- (void) printf("interval out of order\n");
- YYERROR;
- }
- }
-break;
-case 18:
-#line 124 "calc1.y"
- {
- yyval.vval = vreg[yystack.l_mark[0].ival];
- }
-break;
-case 19:
-#line 128 "calc1.y"
- {
- yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
- yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
- }
-break;
-case 20:
-#line 133 "calc1.y"
- {
- yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
- yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
- }
-break;
-case 21:
-#line 138 "calc1.y"
- {
- yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
- yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
- }
-break;
-case 22:
-#line 143 "calc1.y"
- {
- yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
- yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
- }
-break;
-case 23:
-#line 148 "calc1.y"
- {
- yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
- }
-break;
-case 24:
-#line 152 "calc1.y"
- {
- yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
- }
-break;
-case 25:
-#line 156 "calc1.y"
- {
- if (dcheck(yystack.l_mark[0].vval)) YYERROR;
- yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
- }
-break;
-case 26:
-#line 161 "calc1.y"
- {
- if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
- yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
- }
-break;
-case 27:
-#line 166 "calc1.y"
- {
- yyval.vval.hi = -yystack.l_mark[0].vval.lo;
- yyval.vval.lo = -yystack.l_mark[0].vval.hi;
- }
-break;
-case 28:
-#line 171 "calc1.y"
- {
- yyval.vval = yystack.l_mark[-1].vval;
- }
-break;
-#line 771 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.03.out b/usr.bin/yacc/tests/regress.03.out
deleted file mode 100644
index a8c9f8c..0000000
--- a/usr.bin/yacc/tests/regress.03.out
+++ /dev/null
@@ -1,603 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 1
-
-#line 9 "calc3.y"
-# include <stdio.h>
-# include <ctype.h>
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM base
-#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
-#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-#line 32 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(int regs[26], int * base)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# ifdef YYLEX_PARAM_TYPE
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
-# else
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
-# endif
-# define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
-# define YYLEX yylex(&yylval, base)
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(regs, base, msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define DIGIT 257
-#define LETTER 258
-#define UMINUS 259
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
- 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
- 10, 11,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
- -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
- -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
- 0, 65, 0,
-};
-#define YYTABLESIZE 220
-static const short yytable[] = { 6,
- 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
- 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
- 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
- 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
- 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
- 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
- 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
- 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
- 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
- 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
- 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
- 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
- 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
-};
-static const short yycheck[] = { 40,
- 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
- 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
- -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
- -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
- -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
- 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
- -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
- 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
- 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
- -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
- -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
- -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 259
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr '+' expr",
-"expr : expr '-' expr",
-"expr : expr '*' expr",
-"expr : expr '/' expr",
-"expr : expr '%' expr",
-"expr : expr '&' expr",
-"expr : expr '|' expr",
-"expr : '-' expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-#line 76 "calc3.y"
- /* start of programs */
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- int regs[26];
- int base = 10;
-
- while(!feof(stdin)) {
- yyparse(regs, &base);
- }
- return 0;
-}
-
-static void
-YYERROR_DECL()
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-YYLEX_DECL()
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- *yylval = (c - 'a');
- return ( LETTER );
- }
- if( isdigit( c )) {
- *yylval = (c - '0') % (*base);
- return ( DIGIT );
- }
- return( c );
-}
-#line 274 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yyerrflag;
- int yychar;
- YYSTYPE yyval;
- YYSTYPE yylval;
-
- /* variables for the parser stack */
- YYSTACKDATA yystack;
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror(regs, base, "syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 38 "calc3.y"
- { yyerrok ; }
-break;
-case 4:
-#line 42 "calc3.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 44 "calc3.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 48 "calc3.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 50 "calc3.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 52 "calc3.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 54 "calc3.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 56 "calc3.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 58 "calc3.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 60 "calc3.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 62 "calc3.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 64 "calc3.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 66 "calc3.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 71 "calc3.y"
- { yyval = yystack.l_mark[0]; (*base) = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 73 "calc3.y"
- { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 543 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror(regs, base, "yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.04.out b/usr.bin/yacc/tests/regress.04.out
deleted file mode 100644
index cd93e86..0000000
--- a/usr.bin/yacc/tests/regress.04.out
+++ /dev/null
@@ -1,595 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "code_calc.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *s);
-#endif
-
-#line 31 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define DIGIT 257
-#define LETTER 258
-#define UMINUS 259
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
- 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
- 10, 11,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
- -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
- -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
- 0, 65, 0,
-};
-#define YYTABLESIZE 220
-static const short yytable[] = { 6,
- 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
- 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
- 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
- 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
- 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
- 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
- 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
- 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
- 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
- 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
- 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
- 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
- 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
-};
-static const short yycheck[] = { 40,
- 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
- 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
- -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
- -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
- -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
- 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
- -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
- 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
- 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
- -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
- -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
- -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 259
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr '+' expr",
-"expr : expr '-' expr",
-"expr : expr '*' expr",
-"expr : expr '/' expr",
-"expr : expr '%' expr",
-"expr : expr '&' expr",
-"expr : expr '|' expr",
-"expr : '-' expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 68 "code_calc.y"
- /* start of programs */
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void)
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 273 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 30 "code_calc.y"
- { yyerrok ; }
-break;
-case 4:
-#line 34 "code_calc.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 36 "code_calc.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 40 "code_calc.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 42 "code_calc.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 44 "code_calc.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 46 "code_calc.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 48 "code_calc.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 50 "code_calc.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 52 "code_calc.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 54 "code_calc.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 56 "code_calc.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 58 "code_calc.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 63 "code_calc.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 65 "code_calc.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 535 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.05.out b/usr.bin/yacc/tests/regress.05.out
deleted file mode 100644
index 2fbf0d9..0000000
--- a/usr.bin/yacc/tests/regress.05.out
+++ /dev/null
@@ -1,425 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "code_error.y"
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *);
-#endif
-
-#line 26 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0,
-};
-static const short yylen[] = { 2,
- 1,
-};
-static const short yydefred[] = { 0,
- 1, 0,
-};
-static const short yydgoto[] = { 2,
-};
-static const short yysindex[] = { -256,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
-};
-#define YYTABLESIZE 0
-static const short yytable[] = { 1,
-};
-static const short yycheck[] = { 256,
-};
-#define YYFINAL 2
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 0
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : S",
-"S : error",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 12 "code_error.y"
-
-#include <stdio.h>
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(void)
-{
- return -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
-#line 164 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.06.out b/usr.bin/yacc/tests/regress.06.out
deleted file mode 100644
index d2305e1..0000000
--- a/usr.bin/yacc/tests/regress.06.out
+++ /dev/null
@@ -1,417 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "error.y"
-int yylex(void);
-static void yyerror(const char *);
-#line 22 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0,
-};
-static const short yylen[] = { 2,
- 1,
-};
-static const short yydefred[] = { 0,
- 1, 0,
-};
-static const short yydgoto[] = { 2,
-};
-static const short yysindex[] = { -256,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
-};
-#define YYTABLESIZE 0
-static const short yytable[] = { 1,
-};
-static const short yycheck[] = { 256,
-};
-#define YYFINAL 2
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 0
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : S",
-"S : error",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 8 "error.y"
-
-#include <stdio.h>
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(void)
-{
- return -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
-#line 156 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.07.out b/usr.bin/yacc/tests/regress.07.out
deleted file mode 100644
index ae185a0..0000000
--- a/usr.bin/yacc/tests/regress.07.out
+++ /dev/null
@@ -1,1912 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 26 "ftp.y"
-
-/* sccsid[] = "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89"; */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <arpa/ftp.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <setjmp.h>
-#include <syslog.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-
-#ifdef YYBISON
-int yylex(void);
-static void yyerror(const char *);
-#endif
-
-extern struct sockaddr_in data_dest;
-extern int logged_in;
-extern struct passwd *pw;
-extern int guest;
-extern int logging;
-extern int type;
-extern int form;
-extern int debug;
-extern int timeout;
-extern int maxtimeout;
-extern int pdata;
-extern char hostname[], remotehost[];
-extern char proctitle[];
-extern char *globerr;
-extern int usedefault;
-extern int transflag;
-extern char tmpline[];
-
-extern char **glob(char *);
-extern char *renamefrom(char *);
-extern void cwd(const char *);
-
-extern void dologout(int);
-extern void fatal(const char *);
-extern void makedir(const char *);
-extern void nack(const char *);
-extern void pass(const char *);
-extern void passive(void);
-extern void pwd(void);
-extern void removedir(char *);
-extern void renamecmd(char *, char *);
-extern void retrieve(const char *, const char *);
-extern void send_file_list(const char *);
-extern void statcmd(void);
-extern void statfilecmd(const char *);
-extern void store(char *, const char *, int);
-extern void user(const char *);
-
-extern void perror_reply(int, const char *, ...);
-extern void reply(int, const char *, ...);
-extern void lreply(int, const char *, ...);
-
-static int cmd_type;
-static int cmd_form;
-static int cmd_bytesz;
-char cbuf[512];
-char *fromname;
-
-struct tab {
- const char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- const char *help;
-};
-
-static char * copy(const char *);
-
-#ifdef YYBISON
-static void sizecmd(char *filename);
-static void help(struct tab *ctab, char *s);
-struct tab cmdtab[];
-struct tab sitetab[];
-#endif
-
-static void
-yyerror(const char *msg)
-{
- perror(msg);
-}
-#line 118 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define A 257
-#define B 258
-#define C 259
-#define E 260
-#define F 261
-#define I 262
-#define L 263
-#define N 264
-#define P 265
-#define R 266
-#define S 267
-#define T 268
-#define SP 269
-#define CRLF 270
-#define COMMA 271
-#define STRING 272
-#define NUMBER 273
-#define USER 274
-#define PASS 275
-#define ACCT 276
-#define REIN 277
-#define QUIT 278
-#define PORT 279
-#define PASV 280
-#define TYPE 281
-#define STRU 282
-#define MODE 283
-#define RETR 284
-#define STOR 285
-#define APPE 286
-#define MLFL 287
-#define MAIL 288
-#define MSND 289
-#define MSOM 290
-#define MSAM 291
-#define MRSQ 292
-#define MRCP 293
-#define ALLO 294
-#define REST 295
-#define RNFR 296
-#define RNTO 297
-#define ABOR 298
-#define DELE 299
-#define CWD 300
-#define LIST 301
-#define NLST 302
-#define SITE 303
-#define STAT 304
-#define HELP 305
-#define NOOP 306
-#define MKD 307
-#define RMD 308
-#define PWD 309
-#define CDUP 310
-#define STOU 311
-#define SMNT 312
-#define SYST 313
-#define SIZE 314
-#define MDTM 315
-#define UMASK 316
-#define IDLE 317
-#define CHMOD 318
-#define LEXERR 319
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 3, 4, 4,
- 12, 5, 13, 13, 13, 6, 6, 6, 6, 6,
- 6, 6, 6, 7, 7, 7, 8, 8, 8, 10,
- 14, 11, 9,
-};
-static const short yylen[] = { 2,
- 0, 2, 2, 4, 4, 4, 2, 4, 4, 4,
- 4, 8, 5, 5, 5, 3, 5, 3, 5, 5,
- 2, 5, 4, 2, 3, 5, 2, 4, 2, 5,
- 5, 3, 3, 4, 6, 5, 7, 9, 4, 6,
- 5, 2, 5, 5, 2, 2, 5, 1, 0, 1,
- 1, 11, 1, 1, 1, 1, 3, 1, 3, 1,
- 1, 3, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 0,
-};
-static const short yydefred[] = { 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 73, 73, 73, 0, 73, 0, 0, 73, 73, 73,
- 73, 0, 0, 0, 0, 73, 73, 73, 73, 73,
- 0, 73, 73, 2, 3, 46, 0, 0, 45, 0,
- 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 24, 0, 0, 0, 0, 0, 21, 0, 0, 27,
- 29, 0, 0, 0, 0, 0, 42, 0, 0, 48,
- 0, 50, 0, 0, 0, 0, 0, 60, 0, 0,
- 64, 66, 65, 0, 68, 69, 67, 0, 0, 0,
- 0, 0, 0, 71, 0, 70, 0, 0, 25, 0,
- 18, 0, 16, 0, 73, 0, 73, 0, 0, 0,
- 0, 32, 33, 0, 0, 0, 4, 5, 0, 6,
- 0, 0, 0, 51, 63, 8, 9, 10, 0, 0,
- 0, 0, 11, 0, 23, 0, 0, 0, 0, 0,
- 34, 0, 0, 39, 0, 0, 28, 0, 0, 0,
- 0, 0, 0, 55, 53, 54, 57, 59, 62, 13,
- 14, 15, 0, 47, 22, 26, 19, 17, 0, 0,
- 36, 0, 0, 20, 30, 31, 41, 43, 44, 0,
- 0, 35, 72, 0, 40, 0, 0, 0, 37, 0,
- 0, 12, 0, 0, 38, 0, 0, 0, 52,
-};
-static const short yydgoto[] = { 1,
- 34, 35, 71, 73, 75, 80, 84, 88, 45, 95,
- 184, 125, 157, 96,
-};
-static const short yysindex[] = { 0,
- -224, -247, -239, -236, -232, -222, -204, -200, -181, -177,
- 0, 0, 0, -166, 0, -161, -199, 0, 0, 0,
- 0, -160, -159, -264, -158, 0, 0, 0, 0, 0,
- -157, 0, 0, 0, 0, 0, -167, -162, 0, -156,
- 0, -250, -198, -165, -155, -154, -153, -151, -150, -152,
- 0, -145, -252, -229, -217, -302, 0, -144, -146, 0,
- 0, -142, -141, -140, -139, -137, 0, -136, -135, 0,
- -134, 0, -133, -132, -130, -131, -128, 0, -249, -127,
- 0, 0, 0, -126, 0, 0, 0, -125, -152, -152,
- -152, -205, -152, 0, -124, 0, -152, -152, 0, -152,
- 0, -143, 0, -173, 0, -171, 0, -152, -123, -152,
- -152, 0, 0, -152, -152, -152, 0, 0, -138, 0,
- -164, -164, -122, 0, 0, 0, 0, 0, -121, -120,
- -118, -148, 0, -117, 0, -116, -115, -114, -113, -112,
- 0, -163, -111, 0, -110, -109, 0, -107, -106, -105,
- -104, -103, -129, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -101, 0, 0, 0, 0, 0, -100, -102,
- 0, -98, -102, 0, 0, 0, 0, 0, 0, -99,
- -97, 0, 0, -95, 0, -96, -94, -92, 0, -152,
- -93, 0, -91, -90, 0, -88, -87, -86, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -83, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, -82, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, -81, -80, 0, -158, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-static const short yygindex[] = { 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 16, -89,
- -25, 35, 47, 0,
-};
-#define YYTABLESIZE 190
-static const short yytable[] = { 129,
- 130, 131, 104, 134, 59, 60, 76, 136, 137, 77,
- 138, 78, 79, 105, 106, 107, 98, 99, 146, 123,
- 148, 149, 36, 124, 150, 151, 152, 46, 47, 37,
- 49, 2, 38, 52, 53, 54, 55, 39, 58, 100,
- 101, 62, 63, 64, 65, 66, 40, 68, 69, 3,
- 4, 102, 103, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 81, 132, 133, 41, 82, 83, 42, 14,
- 51, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 43, 31, 32,
- 33, 44, 85, 86, 154, 140, 141, 143, 144, 155,
- 193, 87, 48, 156, 70, 170, 171, 50, 56, 72,
- 57, 61, 67, 89, 90, 91, 74, 163, 93, 94,
- 142, 92, 145, 97, 108, 109, 110, 111, 139, 112,
- 113, 114, 115, 116, 153, 117, 118, 121, 119, 120,
- 122, 180, 126, 127, 128, 135, 147, 186, 160, 161,
- 124, 162, 164, 165, 166, 167, 168, 159, 173, 169,
- 174, 172, 175, 176, 177, 178, 179, 181, 158, 182,
- 183, 185, 190, 187, 189, 188, 191, 192, 195, 194,
- 196, 0, 0, 198, 197, 73, 199, 49, 56, 58,
-};
-static const short yycheck[] = { 89,
- 90, 91, 305, 93, 269, 270, 257, 97, 98, 260,
- 100, 262, 263, 316, 317, 318, 269, 270, 108, 269,
- 110, 111, 270, 273, 114, 115, 116, 12, 13, 269,
- 15, 256, 269, 18, 19, 20, 21, 270, 23, 269,
- 270, 26, 27, 28, 29, 30, 269, 32, 33, 274,
- 275, 269, 270, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 261, 269, 270, 270, 265, 266, 269, 294,
- 270, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 269, 313, 314,
- 315, 269, 258, 259, 259, 269, 270, 269, 270, 264,
- 190, 267, 269, 268, 272, 269, 270, 269, 269, 272,
- 270, 270, 270, 269, 269, 269, 273, 266, 269, 272,
- 105, 273, 107, 269, 269, 272, 269, 269, 272, 270,
- 270, 269, 269, 269, 273, 270, 270, 269, 271, 270,
- 269, 271, 270, 270, 270, 270, 270, 173, 270, 270,
- 273, 270, 270, 270, 270, 270, 270, 123, 269, 272,
- 270, 273, 270, 270, 270, 270, 270, 269, 122, 270,
- 273, 270, 269, 273, 270, 273, 271, 270, 270, 273,
- 271, -1, -1, 271, 273, 269, 273, 270, 270, 270,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 319
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"A","B","C","E","F","I","L","N",
-"P","R","S","T","SP","CRLF","COMMA","STRING","NUMBER","USER","PASS","ACCT",
-"REIN","QUIT","PORT","PASV","TYPE","STRU","MODE","RETR","STOR","APPE","MLFL",
-"MAIL","MSND","MSOM","MSAM","MRSQ","MRCP","ALLO","REST","RNFR","RNTO","ABOR",
-"DELE","CWD","LIST","NLST","SITE","STAT","HELP","NOOP","MKD","RMD","PWD","CDUP",
-"STOU","SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR",
-"illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : cmd_list",
-"cmd_list :",
-"cmd_list : cmd_list cmd",
-"cmd_list : cmd_list rcmd",
-"cmd : USER SP username CRLF",
-"cmd : PASS SP password CRLF",
-"cmd : PORT SP host_port CRLF",
-"cmd : PASV CRLF",
-"cmd : TYPE SP type_code CRLF",
-"cmd : STRU SP struct_code CRLF",
-"cmd : MODE SP mode_code CRLF",
-"cmd : ALLO SP NUMBER CRLF",
-"cmd : ALLO SP NUMBER SP R SP NUMBER CRLF",
-"cmd : RETR check_login SP pathname CRLF",
-"cmd : STOR check_login SP pathname CRLF",
-"cmd : APPE check_login SP pathname CRLF",
-"cmd : NLST check_login CRLF",
-"cmd : NLST check_login SP STRING CRLF",
-"cmd : LIST check_login CRLF",
-"cmd : LIST check_login SP pathname CRLF",
-"cmd : STAT check_login SP pathname CRLF",
-"cmd : STAT CRLF",
-"cmd : DELE check_login SP pathname CRLF",
-"cmd : RNTO SP pathname CRLF",
-"cmd : ABOR CRLF",
-"cmd : CWD check_login CRLF",
-"cmd : CWD check_login SP pathname CRLF",
-"cmd : HELP CRLF",
-"cmd : HELP SP STRING CRLF",
-"cmd : NOOP CRLF",
-"cmd : MKD check_login SP pathname CRLF",
-"cmd : RMD check_login SP pathname CRLF",
-"cmd : PWD check_login CRLF",
-"cmd : CDUP check_login CRLF",
-"cmd : SITE SP HELP CRLF",
-"cmd : SITE SP HELP SP STRING CRLF",
-"cmd : SITE SP UMASK check_login CRLF",
-"cmd : SITE SP UMASK check_login SP octal_number CRLF",
-"cmd : SITE SP CHMOD check_login SP octal_number SP pathname CRLF",
-"cmd : SITE SP IDLE CRLF",
-"cmd : SITE SP IDLE SP NUMBER CRLF",
-"cmd : STOU check_login SP pathname CRLF",
-"cmd : SYST CRLF",
-"cmd : SIZE check_login SP pathname CRLF",
-"cmd : MDTM check_login SP pathname CRLF",
-"cmd : QUIT CRLF",
-"cmd : error CRLF",
-"rcmd : RNFR check_login SP pathname CRLF",
-"username : STRING",
-"password :",
-"password : STRING",
-"byte_size : NUMBER",
-"host_port : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER",
-"form_code : N",
-"form_code : T",
-"form_code : C",
-"type_code : A",
-"type_code : A SP form_code",
-"type_code : E",
-"type_code : E SP form_code",
-"type_code : I",
-"type_code : L",
-"type_code : L SP byte_size",
-"type_code : L byte_size",
-"struct_code : F",
-"struct_code : R",
-"struct_code : P",
-"mode_code : S",
-"mode_code : B",
-"mode_code : C",
-"pathname : pathstring",
-"pathstring : STRING",
-"octal_number : NUMBER",
-"check_login :",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 707 "ftp.y"
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-extern jmp_buf errcatch;
-
-static void upper(char *);
-
-#define CMD 0 /* beginning of command */
-#define ARGS 1 /* expect miscellaneous arguments */
-#define STR1 2 /* expect SP followed by STRING */
-#define STR2 3 /* expect STRING */
-#define OSTR 4 /* optional SP then STRING */
-#define ZSTR1 5 /* SP then optional STRING */
-#define ZSTR2 6 /* optional STRING after SP */
-#define SITECMD 7 /* SITE command */
-#define NSTR 8 /* Number followed by a string */
-
-struct tab cmdtab[] = { /* In order defined in RFC 765 */
- { "USER", USER, STR1, 1, "<sp> username" },
- { "PASS", PASS, ZSTR1, 1, "<sp> password" },
- { "ACCT", ACCT, STR1, 0, "(specify account)" },
- { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
- { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
- { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
- { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
- { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
- { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
- { "STRU", STRU, ARGS, 1, "(specify file structure)" },
- { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
- { "RETR", RETR, STR1, 1, "<sp> file-name" },
- { "STOR", STOR, STR1, 1, "<sp> file-name" },
- { "APPE", APPE, STR1, 1, "<sp> file-name" },
- { "MLFL", MLFL, OSTR, 0, "(mail file)" },
- { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
- { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
- { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
- { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
- { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
- { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
- { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
- { "REST", REST, ARGS, 0, "(restart command)" },
- { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
- { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
- { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
- { "DELE", DELE, STR1, 1, "<sp> file-name" },
- { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
- { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
- { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
- { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
- { "STAT", STAT, OSTR, 1, "[ <sp> path-name ]" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { "NOOP", NOOP, ARGS, 1, "" },
- { "MKD", MKD, STR1, 1, "<sp> path-name" },
- { "XMKD", MKD, STR1, 1, "<sp> path-name" },
- { "RMD", RMD, STR1, 1, "<sp> path-name" },
- { "XRMD", RMD, STR1, 1, "<sp> path-name" },
- { "PWD", PWD, ARGS, 1, "(return current directory)" },
- { "XPWD", PWD, ARGS, 1, "(return current directory)" },
- { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "STOU", STOU, STR1, 1, "<sp> file-name" },
- { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
- { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
- { 0, 0, 0, 0, 0 }
-};
-
-struct tab sitetab[] = {
- { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
- { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
- { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { 0, 0, 0, 0, 0 }
-};
-
-static struct tab *
-lookup(struct tab *p, char *cmd)
-{
-
- for (; p->name != 0; p++)
- if (strcmp(cmd, p->name) == 0)
- return (p);
- return (0);
-}
-
-#include <arpa/telnet.h>
-
-/*
- * get_line - a hacked up version of fgets to ignore TELNET escape codes.
- */
-static char *
-get_line(char *s, int n, FILE *iop)
-{
- register int c;
- register char *cs;
-
- cs = s;
-/* tmpline may contain saved command from urgent mode interruption */
- for (c = 0; tmpline[c] != '\0' && --n > 0; ++c) {
- *cs++ = tmpline[c];
- if (tmpline[c] == '\n') {
- *cs = '\0';
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- tmpline[0] = '\0';
- return(s);
- }
- if (c == 0)
- tmpline[0] = '\0';
- }
- while ((c = getc(iop)) != EOF) {
- c &= 0377;
- if (c == IAC) {
- if ((c = getc(iop)) != EOF) {
- c &= 0377;
- switch (c) {
- case WILL:
- case WONT:
- c = getc(iop);
- printf("%c%c%c", IAC, DONT, 0377&c);
- (void) fflush(stdout);
- continue;
- case DO:
- case DONT:
- c = getc(iop);
- printf("%c%c%c", IAC, WONT, 0377&c);
- (void) fflush(stdout);
- continue;
- case IAC:
- break;
- default:
- continue; /* ignore command */
- }
- }
- }
- *cs++ = c;
- if (--n <= 0 || c == '\n')
- break;
- }
- if (c == EOF && cs == s)
- return (0);
- *cs = '\0';
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- return (s);
-}
-
-static void
-toolong(int sig)
-{
- time_t now;
-
- (void) sig;
- reply(421,
- "Timeout (%d seconds): closing control connection.", timeout);
- (void) time(&now);
- if (logging) {
- syslog(LOG_INFO,
- "User %s timed out after %d seconds at %s",
- (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
- }
- dologout(1);
-}
-
-int
-yylex(void)
-{
- static int cpos, state;
- register char *cp, *cp2;
- register struct tab *p;
- int n;
- char c;
-
- for (;;) {
- switch (state) {
-
- case CMD:
- (void) signal(SIGALRM, toolong);
- (void) alarm((unsigned) timeout);
- if (get_line(cbuf, sizeof(cbuf)-1, stdin) == 0) {
- reply(221, "You could at least say goodbye.");
- dologout(0);
- }
- (void) alarm(0);
-#ifdef SETPROCTITLE
- if (strncasecmp(cbuf, "PASS", 4) != 0)
- setproctitle("%s: %s", proctitle, cbuf);
-#endif /* SETPROCTITLE */
- if ((cp = strchr(cbuf, '\r'))) {
- *cp++ = '\n';
- *cp = '\0';
- }
- if ((cp = strpbrk(cbuf, " \n")))
- cpos = cp - cbuf;
- if (cpos == 0)
- cpos = 4;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- upper(cbuf);
- p = lookup(cmdtab, cbuf);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- nack(p->name);
- longjmp(errcatch,0);
- /* NOTREACHED */
- }
- state = p->state;
- *(const char **)(&yylval) = p->name;
- return (p->token);
- }
- break;
-
- case SITECMD:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- cp = &cbuf[cpos];
- if ((cp2 = strpbrk(cp, " \n")))
- cpos = cp2 - cbuf;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- upper(cp);
- p = lookup(sitetab, cp);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- state = CMD;
- nack(p->name);
- longjmp(errcatch,0);
- /* NOTREACHED */
- }
- state = p->state;
- *(const char **)(&yylval) = p->name;
- return (p->token);
- }
- state = CMD;
- break;
-
- case OSTR:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR1:
- case ZSTR1:
- dostr1:
- if (cbuf[cpos] == ' ') {
- cpos++;
- if (state == OSTR)
- state = STR2;
- else
- ++state;
- return (SP);
- }
- break;
-
- case ZSTR2:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR2:
- cp = &cbuf[cpos];
- n = strlen(cp);
- cpos += n - 1;
- /*
- * Make sure the string is nonempty and \n terminated.
- */
- if (n > 1 && cbuf[cpos] == '\n') {
- cbuf[cpos] = '\0';
- *(char **)&yylval = copy(cp);
- cbuf[cpos] = '\n';
- state = ARGS;
- return (STRING);
- }
- break;
-
- case NSTR:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- if (isdigit(cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit(cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval = atoi(cp);
- cbuf[cpos] = c;
- state = STR1;
- return (NUMBER);
- }
- state = STR1;
- goto dostr1;
-
- case ARGS:
- if (isdigit(cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit(cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval = atoi(cp);
- cbuf[cpos] = c;
- return (NUMBER);
- }
- switch (cbuf[cpos++]) {
-
- case '\n':
- state = CMD;
- return (CRLF);
-
- case ' ':
- return (SP);
-
- case ',':
- return (COMMA);
-
- case 'A':
- case 'a':
- return (A);
-
- case 'B':
- case 'b':
- return (B);
-
- case 'C':
- case 'c':
- return (C);
-
- case 'E':
- case 'e':
- return (E);
-
- case 'F':
- case 'f':
- return (F);
-
- case 'I':
- case 'i':
- return (I);
-
- case 'L':
- case 'l':
- return (L);
-
- case 'N':
- case 'n':
- return (N);
-
- case 'P':
- case 'p':
- return (P);
-
- case 'R':
- case 'r':
- return (R);
-
- case 'S':
- case 's':
- return (S);
-
- case 'T':
- case 't':
- return (T);
-
- }
- break;
-
- default:
- fatal("Unknown state in scanner.");
- }
- yyerror((char *) 0);
- state = CMD;
- longjmp(errcatch,0);
- }
-}
-
-static void
-upper(char *s)
-{
- while (*s != '\0') {
- if (islower(*s))
- *s = toupper(*s);
- s++;
- }
-}
-
-static char *
-copy(const char *s)
-{
- char *p;
-
- p = (char * )malloc(strlen(s) + 1);
- if (p == 0)
- fatal("Ran out of memory.");
- else
- (void) strcpy(p, s);
- return (p);
-}
-
-static void
-help(struct tab *ctab, char *s)
-{
- register struct tab *c;
- register int width, NCMDS;
- const char *help_type;
-
- if (ctab == sitetab)
- help_type = "SITE ";
- else
- help_type = "";
- width = 0, NCMDS = 0;
- for (c = ctab; c->name != 0; c++) {
- int len = strlen(c->name);
-
- if (len > width)
- width = len;
- NCMDS++;
- }
- width = (width + 8) &~ 7;
- if (s == 0) {
- register int i, j, w;
- int columns, lines;
-
- lreply(214, "The following %scommands are recognized %s.",
- help_type, "(* =>'s unimplemented)");
- columns = 76 / width;
- if (columns == 0)
- columns = 1;
- lines = (NCMDS + columns - 1) / columns;
- for (i = 0; i < lines; i++) {
- printf(" ");
- for (j = 0; j < columns; j++) {
- c = ctab + j * lines + i;
- assert(c->name != 0);
- printf("%s%c", c->name,
- c->implemented ? ' ' : '*');
- if (c + lines >= &ctab[NCMDS])
- break;
- w = strlen(c->name) + 1;
- while (w < width) {
- putchar(' ');
- w++;
- }
- }
- printf("\r\n");
- }
- (void) fflush(stdout);
- reply(214, "Direct comments to ftp-bugs@%s.", hostname);
- return;
- }
- upper(s);
- c = lookup(ctab, s);
- if (c == (struct tab *)0) {
- reply(502, "Unknown command %s.", s);
- return;
- }
- if (c->implemented)
- reply(214, "Syntax: %s%s %s", help_type, c->name, c->help);
- else
- reply(214, "%s%-*s\t%s; unimplemented.", help_type, width,
- c->name, c->help);
-}
-
-static void
-sizecmd(char *filename)
-{
- switch (type) {
- case TYPE_L:
- case TYPE_I: {
- struct stat stbuf;
- if (stat(filename, &stbuf) < 0 ||
- (stbuf.st_mode&S_IFMT) != S_IFREG)
- reply(550, "%s: not a plain file.", filename);
- else
-#ifdef HAVE_LONG_LONG
- reply(213, "%llu", (long long) stbuf.st_size);
-#else
- reply(213, "%lu", stbuf.st_size);
-#endif
- break;}
- case TYPE_A: {
- FILE *fin;
- register int c, count;
- struct stat stbuf;
- fin = fopen(filename, "r");
- if (fin == 0) {
- perror_reply(550, filename);
- return;
- }
- if (fstat(fileno(fin), &stbuf) < 0 ||
- (stbuf.st_mode&S_IFMT) != S_IFREG) {
- reply(550, "%s: not a plain file.", filename);
- (void) fclose(fin);
- return;
- }
-
- count = 0;
- while((c=getc(fin)) != EOF) {
- if (c == '\n') /* will get expanded to \r\n */
- count++;
- count++;
- }
- (void) fclose(fin);
-
- reply(213, "%ld", count);
- break;}
- default:
- reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
- }
-}
-#line 1013 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 2:
-#line 150 "ftp.y"
- {
- fromname = (char *) 0;
- }
-break;
-case 4:
-#line 157 "ftp.y"
- {
- user((char *) yystack.l_mark[-1]);
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 5:
-#line 162 "ftp.y"
- {
- pass((char *) yystack.l_mark[-1]);
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 6:
-#line 167 "ftp.y"
- {
- usedefault = 0;
- if (pdata >= 0) {
- (void) close(pdata);
- pdata = -1;
- }
- reply(200, "PORT command successful.");
- }
-break;
-case 7:
-#line 176 "ftp.y"
- {
- passive();
- }
-break;
-case 8:
-#line 180 "ftp.y"
- {
- switch (cmd_type) {
-
- case TYPE_A:
- if (cmd_form == FORM_N) {
- reply(200, "Type set to A.");
- type = cmd_type;
- form = cmd_form;
- } else
- reply(504, "Form must be N.");
- break;
-
- case TYPE_E:
- reply(504, "Type E not implemented.");
- break;
-
- case TYPE_I:
- reply(200, "Type set to I.");
- type = cmd_type;
- break;
-
- case TYPE_L:
-#if NBBY == 8
- if (cmd_bytesz == 8) {
- reply(200,
- "Type set to L (byte size 8).");
- type = cmd_type;
- } else
- reply(504, "Byte size must be 8.");
-#else /* NBBY == 8 */
- UNIMPLEMENTED for NBBY != 8
-#endif /* NBBY == 8 */
- }
- }
-break;
-case 9:
-#line 215 "ftp.y"
- {
- switch (yystack.l_mark[-1]) {
-
- case STRU_F:
- reply(200, "STRU F ok.");
- break;
-
- default:
- reply(504, "Unimplemented STRU type.");
- }
- }
-break;
-case 10:
-#line 227 "ftp.y"
- {
- switch (yystack.l_mark[-1]) {
-
- case MODE_S:
- reply(200, "MODE S ok.");
- break;
-
- default:
- reply(502, "Unimplemented MODE type.");
- }
- }
-break;
-case 11:
-#line 239 "ftp.y"
- {
- reply(202, "ALLO command ignored.");
- }
-break;
-case 12:
-#line 243 "ftp.y"
- {
- reply(202, "ALLO command ignored.");
- }
-break;
-case 13:
-#line 247 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- retrieve((char *) 0, (char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 14:
-#line 254 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- store((char *) yystack.l_mark[-1], "w", 0);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 15:
-#line 261 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- store((char *) yystack.l_mark[-1], "a", 0);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 16:
-#line 268 "ftp.y"
- {
- if (yystack.l_mark[-1])
- send_file_list(".");
- }
-break;
-case 17:
-#line 273 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- send_file_list((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 18:
-#line 280 "ftp.y"
- {
- if (yystack.l_mark[-1])
- retrieve("/bin/ls -lgA", "");
- }
-break;
-case 19:
-#line 285 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- retrieve("/bin/ls -lgA %s", (char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 20:
-#line 292 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- statfilecmd((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 21:
-#line 299 "ftp.y"
- {
- statcmd();
- }
-break;
-case 22:
-#line 303 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- remove((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 23:
-#line 310 "ftp.y"
- {
- if (fromname) {
- renamecmd(fromname, (char *) yystack.l_mark[-1]);
- free(fromname);
- fromname = (char *) 0;
- } else {
- reply(503, "Bad sequence of commands.");
- }
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 24:
-#line 321 "ftp.y"
- {
- reply(225, "ABOR command successful.");
- }
-break;
-case 25:
-#line 325 "ftp.y"
- {
- if (yystack.l_mark[-1])
- cwd(pw->pw_dir);
- }
-break;
-case 26:
-#line 330 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- cwd((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 27:
-#line 337 "ftp.y"
- {
- help(cmdtab, (char *) 0);
- }
-break;
-case 28:
-#line 341 "ftp.y"
- {
- register char *cp = (char *)yystack.l_mark[-1];
-
- if (strncasecmp(cp, "SITE", 4) == 0) {
- cp = (char *)yystack.l_mark[-1] + 4;
- if (*cp == ' ')
- cp++;
- if (*cp)
- help(sitetab, cp);
- else
- help(sitetab, (char *) 0);
- } else
- help(cmdtab, (char *) yystack.l_mark[-1]);
- }
-break;
-case 29:
-#line 356 "ftp.y"
- {
- reply(200, "NOOP command successful.");
- }
-break;
-case 30:
-#line 360 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- makedir((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 31:
-#line 367 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- removedir((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 32:
-#line 374 "ftp.y"
- {
- if (yystack.l_mark[-1])
- pwd();
- }
-break;
-case 33:
-#line 379 "ftp.y"
- {
- if (yystack.l_mark[-1])
- cwd("..");
- }
-break;
-case 34:
-#line 384 "ftp.y"
- {
- help(sitetab, (char *) 0);
- }
-break;
-case 35:
-#line 388 "ftp.y"
- {
- help(sitetab, (char *) yystack.l_mark[-1]);
- }
-break;
-case 36:
-#line 392 "ftp.y"
- {
- int oldmask;
-
- if (yystack.l_mark[-1]) {
- oldmask = umask(0);
- (void) umask(oldmask);
- reply(200, "Current UMASK is %03o", oldmask);
- }
- }
-break;
-case 37:
-#line 402 "ftp.y"
- {
- int oldmask;
-
- if (yystack.l_mark[-3]) {
- if ((yystack.l_mark[-1] == -1) || (yystack.l_mark[-1] > 0777)) {
- reply(501, "Bad UMASK value");
- } else {
- oldmask = umask(yystack.l_mark[-1]);
- reply(200,
- "UMASK set to %03o (was %03o)",
- yystack.l_mark[-1], oldmask);
- }
- }
- }
-break;
-case 38:
-#line 417 "ftp.y"
- {
- if (yystack.l_mark[-5] && (yystack.l_mark[-1] != 0)) {
- if (yystack.l_mark[-3] > 0777)
- reply(501,
- "CHMOD: Mode value must be between 0 and 0777");
- else if (chmod((char *) yystack.l_mark[-1], yystack.l_mark[-3]) < 0)
- perror_reply(550, (char *) yystack.l_mark[-1]);
- else
- reply(200, "CHMOD command successful.");
- }
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 39:
-#line 431 "ftp.y"
- {
- reply(200,
- "Current IDLE time limit is %d seconds; max %d",
- timeout, maxtimeout);
- }
-break;
-case 40:
-#line 437 "ftp.y"
- {
- if (yystack.l_mark[-1] < 30 || yystack.l_mark[-1] > maxtimeout) {
- reply(501,
- "Maximum IDLE time must be between 30 and %d seconds",
- maxtimeout);
- } else {
- timeout = yystack.l_mark[-1];
- (void) alarm((unsigned) timeout);
- reply(200,
- "Maximum IDLE time set to %d seconds",
- timeout);
- }
- }
-break;
-case 41:
-#line 451 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- store((char *) yystack.l_mark[-1], "w", 1);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 42:
-#line 458 "ftp.y"
- {
-#ifdef unix
-#ifdef BSD
- reply(215, "UNIX Type: L%d Version: BSD-%d",
- NBBY, BSD);
-#else /* BSD */
- reply(215, "UNIX Type: L%d", NBBY);
-#endif /* BSD */
-#else /* unix */
- reply(215, "UNKNOWN Type: L%d", NBBY);
-#endif /* unix */
- }
-break;
-case 43:
-#line 479 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
- sizecmd((char *) yystack.l_mark[-1]);
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 44:
-#line 496 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0) {
- struct stat stbuf;
- if (stat((char *) yystack.l_mark[-1], &stbuf) < 0)
- perror_reply(550, "%s", (char *) yystack.l_mark[-1]);
- else if ((stbuf.st_mode&S_IFMT) != S_IFREG) {
- reply(550, "%s: not a plain file.",
- (char *) yystack.l_mark[-1]);
- } else {
- register struct tm *t;
- t = gmtime(&stbuf.st_mtime);
- reply(213,
- "%04d%02d%02d%02d%02d%02d",
- 1900 + t->tm_year,
- t->tm_mon+1, t->tm_mday,
- t->tm_hour, t->tm_min, t->tm_sec);
- }
- }
- if (yystack.l_mark[-1] != 0)
- free((char *) yystack.l_mark[-1]);
- }
-break;
-case 45:
-#line 518 "ftp.y"
- {
- reply(221, "Goodbye.");
- dologout(0);
- }
-break;
-case 46:
-#line 523 "ftp.y"
- {
- yyerrok;
- }
-break;
-case 47:
-#line 528 "ftp.y"
- {
- if (yystack.l_mark[-3] && yystack.l_mark[-1]) {
- fromname = renamefrom((char *) yystack.l_mark[-1]);
- if (fromname == (char *) 0 && yystack.l_mark[-1]) {
- free((char *) yystack.l_mark[-1]);
- }
- }
- }
-break;
-case 49:
-#line 542 "ftp.y"
- {
- *(const char **)(&(yyval)) = "";
- }
-break;
-case 52:
-#line 553 "ftp.y"
- {
- register char *a, *p;
-
- a = (char *)&data_dest.sin_addr;
- a[0] = yystack.l_mark[-10]; a[1] = yystack.l_mark[-8]; a[2] = yystack.l_mark[-6]; a[3] = yystack.l_mark[-4];
- p = (char *)&data_dest.sin_port;
- p[0] = yystack.l_mark[-2]; p[1] = yystack.l_mark[0];
- data_dest.sin_family = AF_INET;
- }
-break;
-case 53:
-#line 565 "ftp.y"
- {
- yyval = FORM_N;
- }
-break;
-case 54:
-#line 569 "ftp.y"
- {
- yyval = FORM_T;
- }
-break;
-case 55:
-#line 573 "ftp.y"
- {
- yyval = FORM_C;
- }
-break;
-case 56:
-#line 579 "ftp.y"
- {
- cmd_type = TYPE_A;
- cmd_form = FORM_N;
- }
-break;
-case 57:
-#line 584 "ftp.y"
- {
- cmd_type = TYPE_A;
- cmd_form = yystack.l_mark[0];
- }
-break;
-case 58:
-#line 589 "ftp.y"
- {
- cmd_type = TYPE_E;
- cmd_form = FORM_N;
- }
-break;
-case 59:
-#line 594 "ftp.y"
- {
- cmd_type = TYPE_E;
- cmd_form = yystack.l_mark[0];
- }
-break;
-case 60:
-#line 599 "ftp.y"
- {
- cmd_type = TYPE_I;
- }
-break;
-case 61:
-#line 603 "ftp.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = NBBY;
- }
-break;
-case 62:
-#line 608 "ftp.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = yystack.l_mark[0];
- }
-break;
-case 63:
-#line 614 "ftp.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = yystack.l_mark[0];
- }
-break;
-case 64:
-#line 621 "ftp.y"
- {
- yyval = STRU_F;
- }
-break;
-case 65:
-#line 625 "ftp.y"
- {
- yyval = STRU_R;
- }
-break;
-case 66:
-#line 629 "ftp.y"
- {
- yyval = STRU_P;
- }
-break;
-case 67:
-#line 635 "ftp.y"
- {
- yyval = MODE_S;
- }
-break;
-case 68:
-#line 639 "ftp.y"
- {
- yyval = MODE_B;
- }
-break;
-case 69:
-#line 643 "ftp.y"
- {
- yyval = MODE_C;
- }
-break;
-case 70:
-#line 649 "ftp.y"
- {
- /*
- * Problem: this production is used for all pathname
- * processing, but only gives a 550 error reply.
- * This is a valid reply in some cases but not in others.
- */
- if (logged_in && yystack.l_mark[0] && strncmp((char *) yystack.l_mark[0], "~", 1) == 0) {
- *(char **)&(yyval) = *glob((char *) yystack.l_mark[0]);
- if (globerr != 0) {
- reply(550, globerr);
- yyval = 0;
- }
- free((char *) yystack.l_mark[0]);
- } else
- yyval = yystack.l_mark[0];
- }
-break;
-case 72:
-#line 671 "ftp.y"
- {
- register int ret, dec, multby, digit;
-
- /*
- * Convert a number that was read as decimal number
- * to what it would be if it had been read as octal.
- */
- dec = yystack.l_mark[0];
- multby = 1;
- ret = 0;
- while (dec) {
- digit = dec%10;
- if (digit > 7) {
- ret = -1;
- break;
- }
- ret += digit * multby;
- multby *= 8;
- dec /= 10;
- }
- yyval = ret;
- }
-break;
-case 73:
-#line 696 "ftp.y"
- {
- if (logged_in)
- yyval = 1;
- else {
- reply(530, "Please login with USER and PASS.");
- yyval = 0;
- }
- }
-break;
-#line 1852 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.08.out b/usr.bin/yacc/tests/regress.08.out
deleted file mode 100644
index d5d3ae0..0000000
--- a/usr.bin/yacc/tests/regress.08.out
+++ /dev/null
@@ -1,1942 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 9 "grammar.y"
-#ifdef YYBISON
-#include <stdlib.h>
-#define YYSTYPE_IS_DECLARED
-#define yyerror yaccError
-#endif
-
-#if defined(YYBISON) || !defined(YYBYACC)
-static void yyerror(const char *s);
-#endif
-#line 81 "grammar.y"
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#define OPT_LINTLIBRARY 1
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-/* #include "cproto.h" */
-#define MAX_TEXT_SIZE 1024
-
-/* Prototype styles */
-#if OPT_LINTLIBRARY
-#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
-#define PROTO_LINTLIBRARY -1 /* form lint-library source */
-#endif
-#define PROTO_NONE 0 /* do not output any prototypes */
-#define PROTO_TRADITIONAL 1 /* comment out parameters */
-#define PROTO_ABSTRACT 2 /* comment out parameter names */
-#define PROTO_ANSI 3 /* ANSI C prototype */
-
-typedef int PrototypeStyle;
-
-typedef char boolean;
-
-extern boolean types_out;
-extern PrototypeStyle proto_style;
-
-#define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
-#define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
-#define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
-
-#if OPT_LINTLIBRARY
-#define FUNC_UNKNOWN -1 /* unspecified */
-#else
-#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
-#endif
-#define FUNC_NONE 0 /* not a function definition */
-#define FUNC_TRADITIONAL 1 /* traditional style */
-#define FUNC_ANSI 2 /* ANSI style */
-#define FUNC_BOTH 3 /* both styles */
-
-typedef int FuncDefStyle;
-
-/* Source file text */
-typedef struct text {
- char text[MAX_TEXT_SIZE]; /* source text */
- long begin; /* offset in temporary file */
-} Text;
-
-/* Declaration specifier flags */
-#define DS_NONE 0 /* default */
-#define DS_EXTERN 1 /* contains "extern" specifier */
-#define DS_STATIC 2 /* contains "static" specifier */
-#define DS_CHAR 4 /* contains "char" type specifier */
-#define DS_SHORT 8 /* contains "short" type specifier */
-#define DS_FLOAT 16 /* contains "float" type specifier */
-#define DS_INLINE 32 /* contains "inline" specifier */
-#define DS_JUNK 64 /* we're not interested in this declaration */
-
-/* This structure stores information about a declaration specifier. */
-typedef struct decl_spec {
- unsigned short flags; /* flags defined above */
- char *text; /* source text */
- long begin; /* offset in temporary file */
-} DeclSpec;
-
-/* This is a list of function parameters. */
-typedef struct _ParameterList {
- struct parameter *first; /* pointer to first parameter in list */
- struct parameter *last; /* pointer to last parameter in list */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- char *comment; /* comment at start of parameter list */
-} ParameterList;
-
-/* This structure stores information about a declarator. */
-typedef struct _Declarator {
- char *name; /* name of variable or function */
- char *text; /* source text */
- long begin; /* offset in temporary file */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- FuncDefStyle func_def; /* style of function definition */
- ParameterList params; /* function parameters */
- boolean pointer; /* TRUE if it declares a pointer */
- struct _Declarator *head; /* head function declarator */
- struct _Declarator *func_stack; /* stack of function declarators */
- struct _Declarator *next; /* next declarator in list */
-} Declarator;
-
-/* This structure stores information about a function parameter. */
-typedef struct parameter {
- struct parameter *next; /* next parameter in list */
- DeclSpec decl_spec;
- Declarator *declarator;
- char *comment; /* comment following the parameter */
-} Parameter;
-
-/* This is a list of declarators. */
-typedef struct declarator_list {
- Declarator *first; /* pointer to first declarator in list */
- Declarator *last; /* pointer to last declarator in list */
-} DeclaratorList;
-
-/* #include "symbol.h" */
-typedef struct symbol {
- struct symbol *next; /* next symbol in list */
- char *name; /* name of symbol */
- char *value; /* value of symbol (for defines) */
- short flags; /* symbol attributes */
-} Symbol;
-
-/* parser stack entry type */
-typedef union {
- Text text;
- DeclSpec decl_spec;
- Parameter *parameter;
- ParameterList param_list;
- Declarator *declarator;
- DeclaratorList decl_list;
-} YYSTYPE;
-
-/* The hash table length should be a prime number. */
-#define SYM_MAX_HASH 251
-
-typedef struct symbol_table {
- Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
-} SymbolTable;
-
-extern SymbolTable *new_symbol_table /* Create symbol table */
- (void);
-extern void free_symbol_table /* Destroy symbol table */
- (SymbolTable *s);
-extern Symbol *find_symbol /* Lookup symbol name */
- (SymbolTable *s, const char *n);
-extern Symbol *new_symbol /* Define new symbol */
- (SymbolTable *s, const char *n, const char *v, int f);
-
-/* #include "semantic.h" */
-extern void new_decl_spec (DeclSpec *, const char *, long, int);
-extern void free_decl_spec (DeclSpec *);
-extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
-extern void check_untagged (DeclSpec *);
-extern Declarator *new_declarator (const char *, const char *, long);
-extern void free_declarator (Declarator *);
-extern void new_decl_list (DeclaratorList *, Declarator *);
-extern void free_decl_list (DeclaratorList *);
-extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
-extern Parameter *new_parameter (DeclSpec *, Declarator *);
-extern void free_parameter (Parameter *);
-extern void new_param_list (ParameterList *, Parameter *);
-extern void free_param_list (ParameterList *);
-extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
-extern void new_ident_list (ParameterList *);
-extern void add_ident_list (ParameterList *, ParameterList *, const char *);
-extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
-extern void gen_declarations (DeclSpec *, DeclaratorList *);
-extern void gen_prototype (DeclSpec *, Declarator *);
-extern void gen_func_declarator (Declarator *);
-extern void gen_func_definition (DeclSpec *, Declarator *);
-
-extern void init_parser (void);
-extern void process_file (FILE *infile, char *name);
-extern char *cur_text (void);
-extern char *cur_file_name (void);
-extern char *implied_typedef (void);
-extern void include_file (char *name, int convert);
-extern char *supply_parm (int count);
-extern char *xstrdup (const char *);
-extern int already_declared (char *name);
-extern int is_actual_func (Declarator *d);
-extern int lint_ellipsis (Parameter *p);
-extern int want_typedef (void);
-extern void begin_tracking (void);
-extern void begin_typedef (void);
-extern void copy_typedef (char *s);
-extern void ellipsis_varargs (Declarator *d);
-extern void end_typedef (void);
-extern void flush_varargs (void);
-extern void fmt_library (int code);
-extern void imply_typedef (const char *s);
-extern void indent (FILE *outf);
-extern void put_blankline (FILE *outf);
-extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
-extern void put_char (FILE *outf, int c);
-extern void put_error (void);
-extern void put_newline (FILE *outf);
-extern void put_padded (FILE *outf, const char *s);
-extern void put_string (FILE *outf, const char *s);
-extern void track_in (void);
-
-extern boolean file_comments;
-extern FuncDefStyle func_style;
-extern char base_file[];
-
-extern int yylex (void);
-
-/* declaration specifier attributes for the typedef statement currently being
- * scanned
- */
-static int cur_decl_spec_flags;
-
-/* pointer to parameter list for the current function definition */
-static ParameterList *func_params;
-
-/* A parser semantic action sets this pointer to the current declarator in
- * a function parameter declaration in order to catch any comments following
- * the parameter declaration on the same line. If the lexer scans a comment
- * and <cur_declarator> is not NULL, then the comment is attached to the
- * declarator. To ignore subsequent comments, the lexer sets this to NULL
- * after scanning a comment or end of line.
- */
-static Declarator *cur_declarator;
-
-/* temporary string buffer */
-static char buf[MAX_TEXT_SIZE];
-
-/* table of typedef names */
-static SymbolTable *typedef_names;
-
-/* table of define names */
-static SymbolTable *define_names;
-
-/* table of type qualifiers */
-static SymbolTable *type_qualifiers;
-
-/* information about the current input file */
-typedef struct {
- char *base_name; /* base input file name */
- char *file_name; /* current file name */
- FILE *file; /* input file */
- unsigned line_num; /* current line number in input file */
- FILE *tmp_file; /* temporary file */
- long begin_comment; /* tmp file offset after last written ) or ; */
- long end_comment; /* tmp file offset after last comment */
- boolean convert; /* if TRUE, convert function definitions */
- boolean changed; /* TRUE if conversion done in this file */
-} IncludeStack;
-
-static IncludeStack *cur_file; /* current input file */
-
-/* #include "yyerror.c" */
-
-static int haveAnsiParam (void);
-
-
-/* Flags to enable us to find if a procedure returns a value.
- */
-static int return_val; /* nonzero on BRACES iff return-expression found */
-
-static const char *
-dft_decl_spec (void)
-{
- return (lintLibrary() && !return_val) ? "void" : "int";
-}
-
-static int
-haveAnsiParam (void)
-{
- Parameter *p;
- if (func_params != 0) {
- for (p = func_params->first; p != 0; p = p->next) {
- if (p->declarator->func_def == FUNC_ANSI) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-#line 306 "/dev/stdout"
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define T_IDENTIFIER 257
-#define T_TYPEDEF_NAME 258
-#define T_DEFINE_NAME 259
-#define T_AUTO 260
-#define T_EXTERN 261
-#define T_REGISTER 262
-#define T_STATIC 263
-#define T_TYPEDEF 264
-#define T_INLINE 265
-#define T_EXTENSION 266
-#define T_CHAR 267
-#define T_DOUBLE 268
-#define T_FLOAT 269
-#define T_INT 270
-#define T_VOID 271
-#define T_LONG 272
-#define T_SHORT 273
-#define T_SIGNED 274
-#define T_UNSIGNED 275
-#define T_ENUM 276
-#define T_STRUCT 277
-#define T_UNION 278
-#define T_Bool 279
-#define T_Complex 280
-#define T_Imaginary 281
-#define T_TYPE_QUALIFIER 282
-#define T_BRACKETS 283
-#define T_LBRACE 284
-#define T_MATCHRBRACE 285
-#define T_ELLIPSIS 286
-#define T_INITIALIZER 287
-#define T_STRING_LITERAL 288
-#define T_ASM 289
-#define T_ASMARG 290
-#define T_VA_DCL 291
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
- 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
- 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
- 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
- 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
- 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
- 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
- 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
- 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13,
-};
-static const short yylen[] = { 2,
- 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
- 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
- 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
- 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
- 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
- 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
- 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
- 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
- 4, 3, 3, 2,
-};
-static const short yydefred[] = { 0,
- 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
- 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
- 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
- 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
- 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
- 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
- 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
- 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
- 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
- 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
- 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
- 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
- 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
- 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
- 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
-};
-static const short yydgoto[] = { 33,
- 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
- 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
- 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
- 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
- 112,
-};
-static const short yysindex[] = { -2,
- -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
- 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
- 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
- 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
- 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
- -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
- 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
- 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
- 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
- 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
- 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
- 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
- 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
-};
-static const short yyrindex[] = { 99,
- 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
- 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
- 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
- 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
- 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
- 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-static const short yygindex[] = { 0,
- 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
- -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
- 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
- -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
- 0,
-};
-#define YYTABLESIZE 924
-static const short yytable[] = { 58,
- 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
- 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
- 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
- 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
- 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
- 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
- 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
- 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
- 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
- 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
- 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
- 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
- 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
- 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
- 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
- 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
- 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
- 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
- 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
- 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
- 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
- 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
- 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
- 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
- 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
- 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
- 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
- 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
- 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
- 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
- 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
- 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
- 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
- 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
- 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
- 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
- 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
- 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
- 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
- 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
- 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
- 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
- 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
- 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
- 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30,
-};
-static const short yycheck[] = { 38,
- 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
- 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
- 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
- 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
- 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
- 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
- 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
- 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
- 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
- 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
- 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
- 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
- -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
- -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
- -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
- -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
- 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
- -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
- 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
- -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
- 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
- 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
- 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
- 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
- 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
- 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
- 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
- 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
- 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
- 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
- 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
- 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
- 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
- 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
- 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
- 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
- -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
- 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
- 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
- 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
- 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
- -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
- -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
- 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
- -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
- 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
- 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
- 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
- -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
- 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
- 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
- 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
- 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
- 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
- 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
- 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
- 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
- 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
- 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
- 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
- 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
- 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
- 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
- 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
- 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
- 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
- 279, 280, 281, 282,
-};
-#define YYFINAL 33
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 291
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
-"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
-"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
-"T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
-"T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
-"T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
-"T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
-"illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : program",
-"program :",
-"program : translation_unit",
-"translation_unit : external_declaration",
-"translation_unit : translation_unit external_declaration",
-"external_declaration : declaration",
-"external_declaration : function_definition",
-"external_declaration : ';'",
-"external_declaration : linkage_specification",
-"external_declaration : T_ASM T_ASMARG ';'",
-"external_declaration : error T_MATCHRBRACE",
-"external_declaration : error ';'",
-"braces : T_LBRACE T_MATCHRBRACE",
-"linkage_specification : T_EXTERN T_STRING_LITERAL braces",
-"linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
-"declaration : decl_specifiers ';'",
-"declaration : decl_specifiers init_declarator_list ';'",
-"$$1 :",
-"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
-"any_typedef : T_EXTENSION T_TYPEDEF",
-"any_typedef : T_TYPEDEF",
-"opt_declarator_list :",
-"opt_declarator_list : declarator_list",
-"declarator_list : declarator",
-"declarator_list : declarator_list ',' declarator",
-"$$2 :",
-"$$3 :",
-"function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
-"$$4 :",
-"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
-"opt_declaration_list :",
-"opt_declaration_list : T_VA_DCL",
-"opt_declaration_list : declaration_list",
-"declaration_list : declaration",
-"declaration_list : declaration_list declaration",
-"decl_specifiers : decl_specifier",
-"decl_specifiers : decl_specifiers decl_specifier",
-"decl_specifier : storage_class",
-"decl_specifier : type_specifier",
-"decl_specifier : type_qualifier",
-"storage_class : T_AUTO",
-"storage_class : T_EXTERN",
-"storage_class : T_REGISTER",
-"storage_class : T_STATIC",
-"storage_class : T_INLINE",
-"storage_class : T_EXTENSION",
-"type_specifier : T_CHAR",
-"type_specifier : T_DOUBLE",
-"type_specifier : T_FLOAT",
-"type_specifier : T_INT",
-"type_specifier : T_LONG",
-"type_specifier : T_SHORT",
-"type_specifier : T_SIGNED",
-"type_specifier : T_UNSIGNED",
-"type_specifier : T_VOID",
-"type_specifier : T_Bool",
-"type_specifier : T_Complex",
-"type_specifier : T_Imaginary",
-"type_specifier : T_TYPEDEF_NAME",
-"type_specifier : struct_or_union_specifier",
-"type_specifier : enum_specifier",
-"type_qualifier : T_TYPE_QUALIFIER",
-"type_qualifier : T_DEFINE_NAME",
-"struct_or_union_specifier : struct_or_union any_id braces",
-"struct_or_union_specifier : struct_or_union braces",
-"struct_or_union_specifier : struct_or_union any_id",
-"struct_or_union : T_STRUCT",
-"struct_or_union : T_UNION",
-"init_declarator_list : init_declarator",
-"init_declarator_list : init_declarator_list ',' init_declarator",
-"init_declarator : declarator",
-"$$5 :",
-"init_declarator : declarator '=' $$5 T_INITIALIZER",
-"enum_specifier : enumeration any_id braces",
-"enum_specifier : enumeration braces",
-"enum_specifier : enumeration any_id",
-"enumeration : T_ENUM",
-"any_id : T_IDENTIFIER",
-"any_id : T_TYPEDEF_NAME",
-"declarator : pointer direct_declarator",
-"declarator : direct_declarator",
-"direct_declarator : identifier_or_ref",
-"direct_declarator : '(' declarator ')'",
-"direct_declarator : direct_declarator T_BRACKETS",
-"direct_declarator : direct_declarator '(' parameter_type_list ')'",
-"direct_declarator : direct_declarator '(' opt_identifier_list ')'",
-"pointer : '*' opt_type_qualifiers",
-"pointer : '*' opt_type_qualifiers pointer",
-"opt_type_qualifiers :",
-"opt_type_qualifiers : type_qualifier_list",
-"type_qualifier_list : type_qualifier",
-"type_qualifier_list : type_qualifier_list type_qualifier",
-"parameter_type_list : parameter_list",
-"parameter_type_list : parameter_list ',' T_ELLIPSIS",
-"parameter_list : parameter_declaration",
-"parameter_list : parameter_list ',' parameter_declaration",
-"parameter_declaration : decl_specifiers declarator",
-"parameter_declaration : decl_specifiers abs_declarator",
-"parameter_declaration : decl_specifiers",
-"opt_identifier_list :",
-"opt_identifier_list : identifier_list",
-"identifier_list : any_id",
-"identifier_list : identifier_list ',' any_id",
-"identifier_or_ref : any_id",
-"identifier_or_ref : '&' any_id",
-"abs_declarator : pointer",
-"abs_declarator : pointer direct_abs_declarator",
-"abs_declarator : direct_abs_declarator",
-"direct_abs_declarator : '(' abs_declarator ')'",
-"direct_abs_declarator : direct_abs_declarator T_BRACKETS",
-"direct_abs_declarator : T_BRACKETS",
-"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
-"direct_abs_declarator : direct_abs_declarator '(' ')'",
-"direct_abs_declarator : '(' parameter_type_list ')'",
-"direct_abs_declarator : '(' ')'",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 1014 "grammar.y"
-
-/* lex.yy.c */
-#define BEGIN yy_start = 1 + 2 *
-
-#define CPP1 1
-#define INIT1 2
-#define INIT2 3
-#define CURLY 4
-#define LEXYACC 5
-#define ASM 6
-#define CPP_INLINE 7
-
-extern char *yytext;
-extern FILE *yyin, *yyout;
-
-static int curly; /* number of curly brace nesting levels */
-static int ly_count; /* number of occurrences of %% */
-static int inc_depth; /* include nesting level */
-static SymbolTable *included_files; /* files already included */
-static int yy_start = 0; /* start state number */
-
-#define grammar_error(s) yaccError(s)
-
-static void
-yaccError (const char *msg)
-{
- func_params = NULL;
- put_error(); /* tell what line we're on, and what file */
- fprintf(stderr, "%s at token '%s'\n", msg, yytext);
-}
-
-/* Initialize the table of type qualifier keywords recognized by the lexical
- * analyzer.
- */
-void
-init_parser (void)
-{
- static const char *keywords[] = {
- "const",
- "restrict",
- "volatile",
- "interrupt",
-#ifdef vms
- "noshare",
- "readonly",
-#endif
-#if defined(MSDOS) || defined(OS2)
- "__cdecl",
- "__export",
- "__far",
- "__fastcall",
- "__fortran",
- "__huge",
- "__inline",
- "__interrupt",
- "__loadds",
- "__near",
- "__pascal",
- "__saveregs",
- "__segment",
- "__stdcall",
- "__syscall",
- "_cdecl",
- "_cs",
- "_ds",
- "_es",
- "_export",
- "_far",
- "_fastcall",
- "_fortran",
- "_huge",
- "_interrupt",
- "_loadds",
- "_near",
- "_pascal",
- "_saveregs",
- "_seg",
- "_segment",
- "_ss",
- "cdecl",
- "far",
- "huge",
- "near",
- "pascal",
-#ifdef OS2
- "__far16",
-#endif
-#endif
-#ifdef __GNUC__
- /* gcc aliases */
- "__builtin_va_arg",
- "__builtin_va_list",
- "__const",
- "__const__",
- "__inline",
- "__inline__",
- "__restrict",
- "__restrict__",
- "__volatile",
- "__volatile__",
-#endif
- };
- unsigned i;
-
- /* Initialize type qualifier table. */
- type_qualifiers = new_symbol_table();
- for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
- new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
- }
-}
-
-/* Process the C source file. Write function prototypes to the standard
- * output. Convert function definitions and write the converted source
- * code to a temporary file.
- */
-void
-process_file (FILE *infile, char *name)
-{
- char *s;
-
- if (strlen(name) > 2) {
- s = name + strlen(name) - 2;
- if (*s == '.') {
- ++s;
- if (*s == 'l' || *s == 'y')
- BEGIN LEXYACC;
-#if defined(MSDOS) || defined(OS2)
- if (*s == 'L' || *s == 'Y')
- BEGIN LEXYACC;
-#endif
- }
- }
-
- included_files = new_symbol_table();
- typedef_names = new_symbol_table();
- define_names = new_symbol_table();
- inc_depth = -1;
- curly = 0;
- ly_count = 0;
- func_params = NULL;
- yyin = infile;
- include_file(strcpy(base_file, name), func_style != FUNC_NONE);
- if (file_comments) {
-#if OPT_LINTLIBRARY
- if (lintLibrary()) {
- put_blankline(stdout);
- begin_tracking();
- }
-#endif
- put_string(stdout, "/* ");
- put_string(stdout, cur_file_name());
- put_string(stdout, " */\n");
- }
- yyparse();
- free_symbol_table(define_names);
- free_symbol_table(typedef_names);
- free_symbol_table(included_files);
-}
-
-#ifdef NO_LEAKS
-void
-free_parser(void)
-{
- free_symbol_table (type_qualifiers);
-#ifdef FLEX_SCANNER
- if (yy_current_buffer != 0)
- yy_delete_buffer(yy_current_buffer);
-#endif
-}
-#endif
-#line 1006 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 10:
-#line 377 "grammar.y"
- {
- yyerrok;
- }
-break;
-case 11:
-#line 381 "grammar.y"
- {
- yyerrok;
- }
-break;
-case 13:
-#line 392 "grammar.y"
- {
- /* Provide an empty action here so bison will not complain about
- * incompatible types in the default action it normally would
- * have generated.
- */
- }
-break;
-case 14:
-#line 399 "grammar.y"
- {
- /* empty */
- }
-break;
-case 15:
-#line 406 "grammar.y"
- {
-#if OPT_LINTLIBRARY
- if (types_out && want_typedef()) {
- gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
- flush_varargs();
- }
-#endif
- free_decl_spec(&yystack.l_mark[-1].decl_spec);
- end_typedef();
- }
-break;
-case 16:
-#line 417 "grammar.y"
- {
- if (func_params != NULL) {
- set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
- } else {
- gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_list(&yystack.l_mark[-1].decl_list);
- }
- free_decl_spec(&yystack.l_mark[-2].decl_spec);
- end_typedef();
- }
-break;
-case 17:
-#line 431 "grammar.y"
- {
- cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
- free_decl_spec(&yystack.l_mark[0].decl_spec);
- }
-break;
-case 18:
-#line 436 "grammar.y"
- {
- end_typedef();
- }
-break;
-case 19:
-#line 443 "grammar.y"
- {
- begin_typedef();
- }
-break;
-case 20:
-#line 447 "grammar.y"
- {
- begin_typedef();
- }
-break;
-case 23:
-#line 459 "grammar.y"
- {
- int flags = cur_decl_spec_flags;
-
- /* If the typedef is a pointer type, then reset the short type
- * flags so it does not get promoted.
- */
- if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
- flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
- free_declarator(yystack.l_mark[0].declarator);
- }
-break;
-case 24:
-#line 471 "grammar.y"
- {
- int flags = cur_decl_spec_flags;
-
- if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
- flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
- free_declarator(yystack.l_mark[0].declarator);
- }
-break;
-case 25:
-#line 483 "grammar.y"
- {
- check_untagged(&yystack.l_mark[-1].decl_spec);
- if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
- yyerror("syntax error");
- YYERROR;
- }
- func_params = &(yystack.l_mark[0].declarator->head->params);
- func_params->begin_comment = cur_file->begin_comment;
- func_params->end_comment = cur_file->end_comment;
- }
-break;
-case 26:
-#line 494 "grammar.y"
- {
- /* If we're converting to K&R and we've got a nominally K&R
- * function which has a parameter which is ANSI (i.e., a prototyped
- * function pointer), then we must override the deciphered value of
- * 'func_def' so that the parameter will be converted.
- */
- if (func_style == FUNC_TRADITIONAL
- && haveAnsiParam()
- && yystack.l_mark[-3].declarator->head->func_def == func_style) {
- yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
- }
-
- func_params = NULL;
-
- if (cur_file->convert)
- gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
- gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_spec(&yystack.l_mark[-4].decl_spec);
- free_declarator(yystack.l_mark[-3].declarator);
- }
-break;
-case 28:
-#line 519 "grammar.y"
- {
- if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
- yyerror("syntax error");
- YYERROR;
- }
- func_params = &(yystack.l_mark[0].declarator->head->params);
- func_params->begin_comment = cur_file->begin_comment;
- func_params->end_comment = cur_file->end_comment;
- }
-break;
-case 29:
-#line 529 "grammar.y"
- {
- DeclSpec decl_spec;
-
- func_params = NULL;
-
- new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
- if (cur_file->convert)
- gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
- gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
-#if OPT_LINTLIBRARY
- flush_varargs();
-#endif
- free_decl_spec(&decl_spec);
- free_declarator(yystack.l_mark[-4].declarator);
- }
-break;
-case 36:
-#line 560 "grammar.y"
- {
- join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
- free(yystack.l_mark[-1].decl_spec.text);
- free(yystack.l_mark[0].decl_spec.text);
- }
-break;
-case 40:
-#line 575 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 41:
-#line 579 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
- }
-break;
-case 42:
-#line 583 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 43:
-#line 587 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
- }
-break;
-case 44:
-#line 591 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
- }
-break;
-case 45:
-#line 595 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
- }
-break;
-case 46:
-#line 602 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
- }
-break;
-case 47:
-#line 606 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 48:
-#line 610 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
- }
-break;
-case 49:
-#line 614 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 50:
-#line 618 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 51:
-#line 622 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
- }
-break;
-case 52:
-#line 626 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 53:
-#line 630 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 54:
-#line 634 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 55:
-#line 638 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
- }
-break;
-case 56:
-#line 642 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 57:
-#line 646 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 58:
-#line 650 "grammar.y"
- {
- Symbol *s;
- s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
- if (s != NULL)
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
- }
-break;
-case 61:
-#line 662 "grammar.y"
- {
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
- }
-break;
-case 62:
-#line 666 "grammar.y"
- {
- /* This rule allows the <pointer> nonterminal to scan #define
- * names as if they were type modifiers.
- */
- Symbol *s;
- s = find_symbol(define_names, yystack.l_mark[0].text.text);
- if (s != NULL)
- new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
- }
-break;
-case 63:
-#line 679 "grammar.y"
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
- new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
- }
-break;
-case 64:
-#line 686 "grammar.y"
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
- new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
- }
-break;
-case 65:
-#line 693 "grammar.y"
- {
- (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
- new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
- }
-break;
-case 66:
-#line 701 "grammar.y"
- {
- imply_typedef(yyval.text.text);
- }
-break;
-case 67:
-#line 705 "grammar.y"
- {
- imply_typedef(yyval.text.text);
- }
-break;
-case 68:
-#line 712 "grammar.y"
- {
- new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
- }
-break;
-case 69:
-#line 716 "grammar.y"
- {
- add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
- }
-break;
-case 70:
-#line 723 "grammar.y"
- {
- if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
- func_style == FUNC_TRADITIONAL && cur_file->convert) {
- gen_func_declarator(yystack.l_mark[0].declarator);
- fputs(cur_text(), cur_file->tmp_file);
- }
- cur_declarator = yyval.declarator;
- }
-break;
-case 71:
-#line 732 "grammar.y"
- {
- if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
- func_style == FUNC_TRADITIONAL && cur_file->convert) {
- gen_func_declarator(yystack.l_mark[-1].declarator);
- fputs(" =", cur_file->tmp_file);
- }
- }
-break;
-case 73:
-#line 744 "grammar.y"
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
- new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
- }
-break;
-case 74:
-#line 751 "grammar.y"
- {
- char *s;
- if ((s = implied_typedef()) == 0)
- (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
- new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
- }
-break;
-case 75:
-#line 758 "grammar.y"
- {
- (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
- new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
- }
-break;
-case 76:
-#line 766 "grammar.y"
- {
- imply_typedef("enum");
- yyval.text = yystack.l_mark[0].text;
- }
-break;
-case 79:
-#line 779 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[0].declarator;
- (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- yyval.declarator->begin = yystack.l_mark[-1].text.begin;
- yyval.declarator->pointer = TRUE;
- }
-break;
-case 81:
-#line 792 "grammar.y"
- {
- yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
- }
-break;
-case 82:
-#line 796 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[-1].declarator;
- (void)sprintf(buf, "(%s)", yyval.declarator->text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- yyval.declarator->begin = yystack.l_mark[-2].text.begin;
- }
-break;
-case 83:
-#line 804 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[-1].declarator;
- (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- }
-break;
-case 84:
-#line 811 "grammar.y"
- {
- yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
- yyval.declarator->params = yystack.l_mark[-1].param_list;
- yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
- yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
- yyval.declarator->func_def = FUNC_ANSI;
- }
-break;
-case 85:
-#line 819 "grammar.y"
- {
- yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
- yyval.declarator->params = yystack.l_mark[-1].param_list;
- yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
- yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
- yyval.declarator->func_def = FUNC_TRADITIONAL;
- }
-break;
-case 86:
-#line 830 "grammar.y"
- {
- (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
- yyval.text.begin = yystack.l_mark[-1].text.begin;
- }
-break;
-case 87:
-#line 835 "grammar.y"
- {
- (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
- yyval.text.begin = yystack.l_mark[-2].text.begin;
- }
-break;
-case 88:
-#line 843 "grammar.y"
- {
- strcpy(yyval.text.text, "");
- yyval.text.begin = 0L;
- }
-break;
-case 90:
-#line 852 "grammar.y"
- {
- (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
- yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
- free(yystack.l_mark[0].decl_spec.text);
- }
-break;
-case 91:
-#line 858 "grammar.y"
- {
- (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
- yyval.text.begin = yystack.l_mark[-1].text.begin;
- free(yystack.l_mark[0].decl_spec.text);
- }
-break;
-case 93:
-#line 868 "grammar.y"
- {
- add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
- }
-break;
-case 94:
-#line 875 "grammar.y"
- {
- new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
- }
-break;
-case 95:
-#line 879 "grammar.y"
- {
- add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
- }
-break;
-case 96:
-#line 886 "grammar.y"
- {
- check_untagged(&yystack.l_mark[-1].decl_spec);
- yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
- }
-break;
-case 97:
-#line 891 "grammar.y"
- {
- check_untagged(&yystack.l_mark[-1].decl_spec);
- yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
- }
-break;
-case 98:
-#line 896 "grammar.y"
- {
- check_untagged(&yystack.l_mark[0].decl_spec);
- yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
- }
-break;
-case 99:
-#line 904 "grammar.y"
- {
- new_ident_list(&yyval.param_list);
- }
-break;
-case 101:
-#line 912 "grammar.y"
- {
- new_ident_list(&yyval.param_list);
- add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
- }
-break;
-case 102:
-#line 917 "grammar.y"
- {
- add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
- }
-break;
-case 103:
-#line 924 "grammar.y"
- {
- yyval.text = yystack.l_mark[0].text;
- }
-break;
-case 104:
-#line 928 "grammar.y"
- {
-#if OPT_LINTLIBRARY
- if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
- yyval.text = yystack.l_mark[0].text;
- } else
-#endif
- (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
- yyval.text.begin = yystack.l_mark[-1].text.begin;
- }
-break;
-case 105:
-#line 941 "grammar.y"
- {
- yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
- }
-break;
-case 106:
-#line 945 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[0].declarator;
- (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- yyval.declarator->begin = yystack.l_mark[-1].text.begin;
- }
-break;
-case 108:
-#line 957 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[-1].declarator;
- (void)sprintf(buf, "(%s)", yyval.declarator->text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- yyval.declarator->begin = yystack.l_mark[-2].text.begin;
- }
-break;
-case 109:
-#line 965 "grammar.y"
- {
- yyval.declarator = yystack.l_mark[-1].declarator;
- (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
- free(yyval.declarator->text);
- yyval.declarator->text = xstrdup(buf);
- }
-break;
-case 110:
-#line 972 "grammar.y"
- {
- yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
- }
-break;
-case 111:
-#line 976 "grammar.y"
- {
- yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
- yyval.declarator->params = yystack.l_mark[-1].param_list;
- yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
- yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
- yyval.declarator->func_def = FUNC_ANSI;
- }
-break;
-case 112:
-#line 984 "grammar.y"
- {
- yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
- yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
- yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
- yyval.declarator->func_def = FUNC_ANSI;
- }
-break;
-case 113:
-#line 991 "grammar.y"
- {
- Declarator *d;
-
- d = new_declarator("", "", yystack.l_mark[-2].text.begin);
- yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
- yyval.declarator->params = yystack.l_mark[-1].param_list;
- yyval.declarator->func_stack = d;
- yyval.declarator->head = yyval.declarator;
- yyval.declarator->func_def = FUNC_ANSI;
- }
-break;
-case 114:
-#line 1002 "grammar.y"
- {
- Declarator *d;
-
- d = new_declarator("", "", yystack.l_mark[-1].text.begin);
- yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
- yyval.declarator->func_stack = d;
- yyval.declarator->head = yyval.declarator;
- yyval.declarator->func_def = FUNC_ANSI;
- }
-break;
-#line 1882 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.09.out b/usr.bin/yacc/tests/regress.09.out
deleted file mode 100644
index b6c13e2..0000000
--- a/usr.bin/yacc/tests/regress.09.out
+++ /dev/null
@@ -1,599 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "pure_calc.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM &yylval
-#define YYLEX_DECL() yylex(YYSTYPE *yylval)
-#define YYERROR_DECL() yyerror(const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-#line 35 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define DIGIT 257
-#define LETTER 258
-#define UMINUS 259
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
- 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
- 10, 11,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
- -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
- -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
- 0, 65, 0,
-};
-#define YYTABLESIZE 220
-static const short yytable[] = { 6,
- 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
- 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
- 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
- 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
- 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
- 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
- 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
- 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
- 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
- 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
- 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
- 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
- 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
-};
-static const short yycheck[] = { 40,
- 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
- 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
- -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
- -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
- -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
- 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
- -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
- 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
- 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
- -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
- -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
- -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
- -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 259
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr '+' expr",
-"expr : expr '-' expr",
-"expr : expr '*' expr",
-"expr : expr '/' expr",
-"expr : expr '%' expr",
-"expr : expr '&' expr",
-"expr : expr '|' expr",
-"expr : '-' expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 72 "pure_calc.y"
- /* start of programs */
-
-#ifdef YYBYACC
-static int YYLEX_DECL();
-#endif
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-YYERROR_DECL()
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-YYLEX_DECL()
-{
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- *yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- *yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 277 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 34 "pure_calc.y"
- { yyerrok ; }
-break;
-case 4:
-#line 38 "pure_calc.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 40 "pure_calc.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 44 "pure_calc.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 46 "pure_calc.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 48 "pure_calc.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 50 "pure_calc.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 52 "pure_calc.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 54 "pure_calc.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 56 "pure_calc.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 58 "pure_calc.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 60 "pure_calc.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 62 "pure_calc.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 67 "pure_calc.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 69 "pure_calc.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 539 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.10.out b/usr.bin/yacc/tests/regress.10.out
deleted file mode 100644
index f4a5ba4..0000000
--- a/usr.bin/yacc/tests/regress.10.out
+++ /dev/null
@@ -1,429 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "pure_error.y"
-
-#ifdef YYBISON
-#define YYSTYPE int
-#define YYLEX_PARAM &yylval
-#define YYLEX_DECL() yylex(YYSTYPE *yylval)
-#define YYERROR_DECL() yyerror(const char *s)
-int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
-#line 30 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0,
-};
-static const short yylen[] = { 2,
- 1,
-};
-static const short yydefred[] = { 0,
- 1, 0,
-};
-static const short yydgoto[] = { 2,
-};
-static const short yysindex[] = { -256,
- 0, 0,
-};
-static const short yyrindex[] = { 0,
- 0, 0,
-};
-static const short yygindex[] = { 0,
-};
-#define YYTABLESIZE 0
-static const short yytable[] = { 1,
-};
-static const short yycheck[] = { 256,
-};
-#define YYFINAL 2
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 0
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : S",
-"S : error",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 17 "pure_error.y"
-
-#include <stdio.h>
-
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-#endif
-
-int
-main(void)
-{
- printf("yyparse() = %d\n", yyparse());
- return 0;
-}
-
-int
-yylex(YYSTYPE *value)
-{
- return value ? 0 : -1;
-}
-
-static void
-yyerror(const char* s)
-{
- printf("%s\n", s);
-}
-#line 168 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.11.out b/usr.bin/yacc/tests/regress.11.out
deleted file mode 100644
index 8668971..0000000
--- a/usr.bin/yacc/tests/regress.11.out
+++ /dev/null
@@ -1,610 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "quote_calc.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-#line 29 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define OP_ADD 257
-#define ADD 258
-#define OP_SUB 259
-#define SUB 260
-#define OP_MUL 261
-#define MUL 262
-#define OP_DIV 263
-#define DIV 264
-#define OP_MOD 265
-#define MOD 266
-#define OP_AND 267
-#define AND 268
-#define DIGIT 269
-#define LETTER 270
-#define UMINUS 271
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
- 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
- 0, 0,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
- 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
- -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
- -121, -243,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
- 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
- 3, -4,
-};
-static const short yygindex[] = { 0,
- 0, 42, 0,
-};
-#define YYTABLESIZE 258
-static const short yytable[] = { 16,
- 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
- 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
- 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
- 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
- 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
- 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
- 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
- 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
- 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
- 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
- 16, 15, 16, 15, 16, 15, 16, 15,
-};
-static const short yycheck[] = { 10,
- 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
- 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
- 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
- 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
- -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
- -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
- 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
- -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
- 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
- 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
- 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
- 261, 261, 263, 263, 265, 265, 267, 267,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 271
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
-"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
-"illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr OP_ADD expr",
-"expr : expr OP_SUB expr",
-"expr : expr OP_MUL expr",
-"expr : expr OP_DIV expr",
-"expr : expr OP_MOD expr",
-"expr : expr OP_AND expr",
-"expr : expr '|' expr",
-"expr : OP_SUB expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 73 "quote_calc.y"
- /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 288 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 35 "quote_calc.y"
- { yyerrok ; }
-break;
-case 4:
-#line 39 "quote_calc.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 41 "quote_calc.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 45 "quote_calc.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 47 "quote_calc.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 49 "quote_calc.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 51 "quote_calc.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 53 "quote_calc.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 55 "quote_calc.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 57 "quote_calc.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 59 "quote_calc.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 61 "quote_calc.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 63 "quote_calc.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 68 "quote_calc.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 70 "quote_calc.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 550 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.12.out b/usr.bin/yacc/tests/regress.12.out
deleted file mode 100644
index 757c977..0000000
--- a/usr.bin/yacc/tests/regress.12.out
+++ /dev/null
@@ -1,610 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "quote_calc2.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-#line 29 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define OP_ADD 257
-#define ADD 258
-#define OP_SUB 259
-#define SUB 260
-#define OP_MUL 261
-#define MUL 262
-#define OP_DIV 263
-#define DIV 264
-#define OP_MOD 265
-#define MOD 266
-#define OP_AND 267
-#define AND 268
-#define DIGIT 269
-#define LETTER 270
-#define UMINUS 271
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
- 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
- 0, 0,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
- 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
- -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
- -121, -243,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
- 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
- 3, -4,
-};
-static const short yygindex[] = { 0,
- 0, 42, 0,
-};
-#define YYTABLESIZE 259
-static const short yytable[] = { 16,
- 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
- 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
- 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
- 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
- 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
- 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
- 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
- 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
- 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
- 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
- 15, 16, 15, 16, 15, 16, 15, 16, 15,
-};
-static const short yycheck[] = { 10,
- 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
- 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
- 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
- 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
- -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
- -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
- 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
- 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
- -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
- 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
- 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
- 260, 262, 262, 264, 264, 266, 266, 268, 268,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 271
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
-"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
-"illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr \"ADD\" expr",
-"expr : expr \"SUB\" expr",
-"expr : expr \"MUL\" expr",
-"expr : expr \"DIV\" expr",
-"expr : expr \"MOD\" expr",
-"expr : expr \"AND\" expr",
-"expr : expr '|' expr",
-"expr : \"SUB\" expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 73 "quote_calc2.y"
- /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 288 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 35 "quote_calc2.y"
- { yyerrok ; }
-break;
-case 4:
-#line 39 "quote_calc2.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 41 "quote_calc2.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 45 "quote_calc2.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 47 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 49 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 51 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 53 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 55 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 57 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 59 "quote_calc2.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 61 "quote_calc2.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 63 "quote_calc2.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 68 "quote_calc2.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 70 "quote_calc2.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 550 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.13.out b/usr.bin/yacc/tests/regress.13.out
deleted file mode 100644
index 94b717e..0000000
--- a/usr.bin/yacc/tests/regress.13.out
+++ /dev/null
@@ -1,604 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "quote_calc3.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-#line 29 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define OP_ADD 257
-#define OP_SUB 259
-#define OP_MUL 261
-#define OP_DIV 263
-#define OP_MOD 265
-#define OP_AND 267
-#define DIGIT 269
-#define LETTER 270
-#define UMINUS 271
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
- 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
- 0, 0,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
- 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
- -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
- -121, -243,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
- 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
- 3, -4,
-};
-static const short yygindex[] = { 0,
- 0, 42, 0,
-};
-#define YYTABLESIZE 258
-static const short yytable[] = { 16,
- 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
- 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
- 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
- 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
- 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
- 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
- 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
- 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
- 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
- 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
- 16, 15, 16, 15, 16, 15, 16, 15,
-};
-static const short yycheck[] = { 10,
- 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
- 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
- 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
- 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
- -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
- -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
- 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
- -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
- 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
- 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
- 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
- 261, 261, 263, 263, 265, 265, 267, 267,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 271
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
-"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
-"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr OP_ADD expr",
-"expr : expr OP_SUB expr",
-"expr : expr OP_MUL expr",
-"expr : expr OP_DIV expr",
-"expr : expr OP_MOD expr",
-"expr : expr OP_AND expr",
-"expr : expr '|' expr",
-"expr : OP_SUB expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 73 "quote_calc3.y"
- /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 282 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 35 "quote_calc3.y"
- { yyerrok ; }
-break;
-case 4:
-#line 39 "quote_calc3.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 41 "quote_calc3.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 45 "quote_calc3.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 47 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 49 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 51 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 53 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 55 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 57 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 59 "quote_calc3.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 61 "quote_calc3.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 63 "quote_calc3.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 68 "quote_calc3.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 70 "quote_calc3.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 544 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.14.out b/usr.bin/yacc/tests/regress.14.out
deleted file mode 100644
index aecfb49..0000000
--- a/usr.bin/yacc/tests/regress.14.out
+++ /dev/null
@@ -1,604 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYPATCH 20140101
-
-#define YYEMPTY (-1)
-#define yyclearin (yychar = YYEMPTY)
-#define yyerrok (yyerrflag = 0)
-#define YYRECOVERING() (yyerrflag != 0)
-
-#define YYPREFIX "yy"
-
-#define YYPURE 0
-
-#line 2 "quote_calc4.y"
-# include <stdio.h>
-# include <ctype.h>
-
-int regs[26];
-int base;
-
-int yylex(void);
-static void yyerror(const char *s);
-
-#line 29 "/dev/stdout"
-
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-
-/* compatibility with bison */
-#ifdef YYPARSE_PARAM
-/* compatibility with FreeBSD */
-# ifdef YYPARSE_PARAM_TYPE
-# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
-# else
-# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
-# endif
-#else
-# define YYPARSE_DECL() yyparse(void)
-#endif
-
-/* Parameters sent to lex. */
-#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
-# define YYLEX yylex(YYLEX_PARAM)
-#else
-# define YYLEX_DECL() yylex(void)
-# define YYLEX yylex()
-#endif
-
-/* Parameters sent to yyerror. */
-#ifndef YYERROR_DECL
-#define YYERROR_DECL() yyerror(const char *s)
-#endif
-#ifndef YYERROR_CALL
-#define YYERROR_CALL(msg) yyerror(msg)
-#endif
-
-extern int YYPARSE_DECL();
-
-#define OP_ADD 257
-#define OP_SUB 259
-#define OP_MUL 261
-#define OP_DIV 263
-#define OP_MOD 265
-#define OP_AND 267
-#define DIGIT 269
-#define LETTER 270
-#define UMINUS 271
-#define YYERRCODE 256
-static const short yylhs[] = { -1,
- 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
-};
-static const short yylen[] = { 2,
- 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 1, 1, 2,
-};
-static const short yydefred[] = { 1,
- 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
- 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
- 0, 0,
-};
-static const short yydgoto[] = { 1,
- 7, 8, 9,
-};
-static const short yysindex[] = { 0,
- -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
- 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
- -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
- -121, -243,
-};
-static const short yyrindex[] = { 0,
- 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
- 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
- 3, -4,
-};
-static const short yygindex[] = { 0,
- 0, 42, 0,
-};
-#define YYTABLESIZE 259
-static const short yytable[] = { 16,
- 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
- 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
- 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
- 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
- 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
- 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
- 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
- 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
- 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
- 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
- 15, 16, 15, 16, 15, 16, 15, 16, 15,
-};
-static const short yycheck[] = { 10,
- 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
- 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
- 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
- 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
- -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
- -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
- 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
- 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
- -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
- 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
- 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
- 260, 262, 262, 264, 264, 266, 266, 268, 268,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 271
-#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
-#if YYDEBUG
-static const char *yyname[] = {
-
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
-0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
-"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
-"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
-};
-static const char *yyrule[] = {
-"$accept : list",
-"list :",
-"list : list stat '\\n'",
-"list : list error '\\n'",
-"stat : expr",
-"stat : LETTER '=' expr",
-"expr : '(' expr ')'",
-"expr : expr \"ADD-operator\" expr",
-"expr : expr \"SUB-operator\" expr",
-"expr : expr \"MUL-operator\" expr",
-"expr : expr \"DIV-operator\" expr",
-"expr : expr \"MOD-operator\" expr",
-"expr : expr \"AND-operator\" expr",
-"expr : expr '|' expr",
-"expr : \"SUB-operator\" expr",
-"expr : LETTER",
-"expr : number",
-"number : DIGIT",
-"number : number DIGIT",
-
-};
-#endif
-
-int yydebug;
-int yynerrs;
-
-int yyerrflag;
-int yychar;
-YYSTYPE yyval;
-YYSTYPE yylval;
-
-/* define the initial stack-sizes */
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-
-#define YYINITSTACKSIZE 200
-
-typedef struct {
- unsigned stacksize;
- short *s_base;
- short *s_mark;
- short *s_last;
- YYSTYPE *l_base;
- YYSTYPE *l_mark;
-} YYSTACKDATA;
-/* variables for the parser stack */
-static YYSTACKDATA yystack;
-#line 73 "quote_calc4.y"
- /* start of programs */
-
-int
-main (void)
-{
- while(!feof(stdin)) {
- yyparse();
- }
- return 0;
-}
-
-static void
-yyerror(const char *s)
-{
- fprintf(stderr, "%s\n", s);
-}
-
-int
-yylex(void) {
- /* lexical analysis routine */
- /* returns LETTER for a lower case letter, yylval = 0 through 25 */
- /* return DIGIT for a digit, yylval = 0 through 9 */
- /* all other characters are returned immediately */
-
- int c;
-
- while( (c=getchar()) == ' ' ) { /* skip blanks */ }
-
- /* c is now nonblank */
-
- if( islower( c )) {
- yylval = c - 'a';
- return ( LETTER );
- }
- if( isdigit( c )) {
- yylval = c - '0';
- return ( DIGIT );
- }
- return( c );
-}
-#line 282 "/dev/stdout"
-
-#if YYDEBUG
-#include <stdio.h> /* needed for printf */
-#endif
-
-#include <stdlib.h> /* needed for malloc, etc */
-#include <string.h> /* needed for memset */
-
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack(YYSTACKDATA *data)
-{
- int i;
- unsigned newsize;
- short *newss;
- YYSTYPE *newvs;
-
- if ((newsize = data->stacksize) == 0)
- newsize = YYINITSTACKSIZE;
- else if (newsize >= YYMAXDEPTH)
- return -1;
- else if ((newsize *= 2) > YYMAXDEPTH)
- newsize = YYMAXDEPTH;
-
- i = (int) (data->s_mark - data->s_base);
- newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
- if (newss == 0)
- return -1;
-
- data->s_base = newss;
- data->s_mark = newss + i;
-
- newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
- if (newvs == 0)
- return -1;
-
- data->l_base = newvs;
- data->l_mark = newvs + i;
-
- data->stacksize = newsize;
- data->s_last = data->s_base + newsize - 1;
- return 0;
-}
-
-#if YYPURE || defined(YY_NO_LEAKS)
-static void yyfreestack(YYSTACKDATA *data)
-{
- free(data->s_base);
- free(data->l_base);
- memset(data, 0, sizeof(*data));
-}
-#else
-#define yyfreestack(data) /* nothing */
-#endif
-
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-int
-YYPARSE_DECL()
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")) != 0)
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = YYEMPTY;
- yystate = 0;
-
-#if YYPURE
- memset(&yystack, 0, sizeof(yystack));
-#endif
-
- if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
- yystack.s_mark = yystack.s_base;
- yystack.l_mark = yystack.l_base;
- yystate = 0;
- *yystack.s_mark = 0;
-
-yyloop:
- if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- yychar = YYEMPTY;
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-
- yyerror("syntax error");
-
- goto yyerrlab;
-
-yyerrlab:
- ++yynerrs;
-
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- yystate = yytable[yyn];
- *++yystack.s_mark = yytable[yyn];
- *++yystack.l_mark = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yystack.s_mark);
-#endif
- if (yystack.s_mark <= yystack.s_base) goto yyabort;
- --yystack.s_mark;
- --yystack.l_mark;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = YYEMPTY;
- goto yyloop;
- }
-
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- if (yym)
- yyval = yystack.l_mark[1-yym];
- else
- memset(&yyval, 0, sizeof yyval);
- switch (yyn)
- {
-case 3:
-#line 35 "quote_calc4.y"
- { yyerrok ; }
-break;
-case 4:
-#line 39 "quote_calc4.y"
- { printf("%d\n",yystack.l_mark[0]);}
-break;
-case 5:
-#line 41 "quote_calc4.y"
- { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
-break;
-case 6:
-#line 45 "quote_calc4.y"
- { yyval = yystack.l_mark[-1]; }
-break;
-case 7:
-#line 47 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
-break;
-case 8:
-#line 49 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
-break;
-case 9:
-#line 51 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
-break;
-case 10:
-#line 53 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
-break;
-case 11:
-#line 55 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
-break;
-case 12:
-#line 57 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
-break;
-case 13:
-#line 59 "quote_calc4.y"
- { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
-break;
-case 14:
-#line 61 "quote_calc4.y"
- { yyval = - yystack.l_mark[0]; }
-break;
-case 15:
-#line 63 "quote_calc4.y"
- { yyval = regs[yystack.l_mark[0]]; }
-break;
-case 17:
-#line 68 "quote_calc4.y"
- { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
-break;
-case 18:
-#line 70 "quote_calc4.y"
- { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
-break;
-#line 544 "/dev/stdout"
- }
- yystack.s_mark -= yym;
- yystate = *yystack.s_mark;
- yystack.l_mark -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yystack.s_mark = YYFINAL;
- *++yystack.l_mark = yyval;
- if (yychar < 0)
- {
- if ((yychar = YYLEX) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = yyname[YYTRANSLATE(yychar)];
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
-#endif
- if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
- {
- goto yyoverflow;
- }
- *++yystack.s_mark = (short) yystate;
- *++yystack.l_mark = yyval;
- goto yyloop;
-
-yyoverflow:
- yyerror("yacc stack overflow");
-
-yyabort:
- yyfreestack(&yystack);
- return (1);
-
-yyaccept:
- yyfreestack(&yystack);
- return (0);
-}
diff --git a/usr.bin/yacc/tests/regress.sh b/usr.bin/yacc/tests/regress.sh
deleted file mode 100644
index fb3b5a5..0000000
--- a/usr.bin/yacc/tests/regress.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-# $FreeBSD$
-
-echo 1..15
-
-test_yacc() {
- yacc "${@}" | sed -e "s,${SRCDIR}/,,g"
-}
-
-REGRESSION_START($1)
-
-REGRESSION_TEST(`00', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/undefined.y')
-REGRESSION_TEST(`01', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/calc.y')
-REGRESSION_TEST(`02', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/calc1.y')
-REGRESSION_TEST(`03', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/calc3.y')
-REGRESSION_TEST(`04', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/code_calc.y')
-REGRESSION_TEST(`05', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/code_error.y')
-REGRESSION_TEST(`06', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/error.y')
-REGRESSION_TEST(`07', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/ftp.y')
-REGRESSION_TEST(`08', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/grammar.y')
-REGRESSION_TEST(`09', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/pure_calc.y')
-REGRESSION_TEST(`10', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/pure_error.y')
-REGRESSION_TEST(`11', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/quote_calc.y')
-REGRESSION_TEST(`12', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/quote_calc2.y')
-REGRESSION_TEST(`13', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/quote_calc3.y')
-REGRESSION_TEST(`14', `test_yacc -b regress -o /dev/stdout ${SRCDIR}/quote_calc4.y')
-
-REGRESSION_END()
-
diff --git a/usr.bin/yacc/tests/undefined.y b/usr.bin/yacc/tests/undefined.y
deleted file mode 100644
index 33ba005..0000000
--- a/usr.bin/yacc/tests/undefined.y
+++ /dev/null
@@ -1,5 +0,0 @@
-%type <int> rule
-%%
-rule:
- ;
-%%
diff --git a/usr.bin/yacc/tests/yacc_tests.sh b/usr.bin/yacc/tests/yacc_tests.sh
new file mode 100755
index 0000000..9a2973a
--- /dev/null
+++ b/usr.bin/yacc/tests/yacc_tests.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# $FreeBSD$
+
+set -e
+
+cd $(dirname $0)
+
+TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXX)
+TEST_DIR="$TMPDIR/test"
+trap "cd /; rm -Rf $TMPDIR" EXIT INT TERM
+
+# Setup the environment for run_test.sh
+mkdir -p "$TEST_DIR"
+cp -Rf * "$TEST_DIR/."
+echo > "$TMPDIR/config.h"
+ln /usr/bin/yacc $TMPDIR/yacc
+
+log=$TMPDIR/run_test.log
+(cd $TEST_DIR && ./run_test 2>&1 && : > run_test.ok) | tee $log
+if [ -f run_test.ok ] && ! egrep "^...(diff|not found)[^\*]+$" $log; then
+ exit 0
+else
+ exit 1
+fi
diff --git a/usr.bin/yes/yes.1 b/usr.bin/yes/yes.1
index 67bed7c..07795b2 100644
--- a/usr.bin/yes/yes.1
+++ b/usr.bin/yes/yes.1
@@ -28,7 +28,7 @@
.\" @(#)yes.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd June 6, 1993
+.Dd June 4, 2014
.Dt YES 1
.Os
.Sh NAME
@@ -45,6 +45,9 @@ utility outputs
or, by default,
.Dq y ,
forever.
+.Sh SEE ALSO
+.Xr jot 1 ,
+.Xr seq 1
.Sh HISTORY
The
.Nm
diff --git a/usr.bin/ypcat/ypcat.1 b/usr.bin/ypcat/ypcat.1
index 8a25652..7106383 100644
--- a/usr.bin/ypcat/ypcat.1
+++ b/usr.bin/ypcat/ypcat.1
@@ -71,4 +71,4 @@ Display the map nickname table.
.Xr ypbind 8 ,
.Xr ypset 8
.Sh AUTHORS
-.An Theo De Raadt Aq deraadt@theos.com .
+.An Theo De Raadt Aq Mt deraadt@theos.com .
diff --git a/usr.bin/ypmatch/ypmatch.1 b/usr.bin/ypmatch/ypmatch.1
index 5f4a4ca..4291de2 100644
--- a/usr.bin/ypmatch/ypmatch.1
+++ b/usr.bin/ypmatch/ypmatch.1
@@ -72,4 +72,4 @@ Display the map nickname table.
.Xr ypbind 8 ,
.Xr ypset 8
.Sh AUTHORS
-.An Theo De Raadt Aq deraadt@theos.com .
+.An Theo De Raadt Aq Mt deraadt@theos.com .
OpenPOWER on IntegriCloud